itemis Blog

Unleash your artifacts!

Written by Stanley Hillner | Oct 21, 2016

Software is not developed for its own sake, it is usually intended to be used by real customers and needs to be deployed to production systems. In order to assemble larger software compositions all the smaller artifacts that make up the product have to be released before the product itself is ready to be launched. This may happen very often, depending on the chosen release frequency of the product.

The Unleash Maven Plugin

Although the building of software artifacts benefits much from the support of modern build systems such as Maven or Gradle, releasing artifacts is a much more complex task than just building them. Modern build systems and CI/CD tools also try to provide support for those tasks but with mixed results. Let's stay with Maven: Maven e.g. provides the maven-release-plugin which automates the steps that make up some kind of a standard release process. Such a process comprises the following steps for example:

  • checking out the sources
  • adapting the sources with the release versions
  • commiting the adapted sources
  • building the release artifacts
  • creation of an SCM tag with the release sources
  • deploying the release artifacts
  • adapting the project sources for the next development iteration
  • commiting the adapted sources

Sure, there are other approaches working with multiple SCM branches and thousands of additional steps are also possible, but let’s assume these steps to be the basis of a release process as it is applied in many projects. The maven-release-plugin automates this process fairly well but has some major issues when it comes to points like reliability, performance or customization. If you search the net for “maven release” some of the top hits are about massive problems with that plugin. Don’t get me wrong, I think the process as such is well suited for many projects but it’s implementation is too error-prone and inflexible.

For that reason I'd like to introduce an alternative release plugin called Unleash Maven Plugin which is available on Maven Central for general usage. It implements a similar process but with different requirements and constraints that make it much more flexible and failure tolerant. Here are some of the basic requirements and concepts of the plugin:

  • Ensure a higher failure tolerance and automatic rollback in case of an error.
  • The plugin must be customizable to fit more than just the standard release process.
  • Building releases should be more performant and the release overhead must be minimized.
  • Provide a higher usability by simply offering a single goal and many defaults.

The unleash-maven-plugin provides a workflow-based processing model which is highly adaptable with custom workflow steps – simply add those steps to the plugin dependencies and override the default workflow to use them! You are free to use the default behavior, extend the workflow or even slim it down to match your needs.

The failure tolerance is much higher since it is even possible to release artifacts when there are incoming remote changes on the SCM! Embedded merging algorithms ensure that nearly all changes can be merged before committing the next development version. And in the event that something goes wrong there is also a rollback feature implemented which brings everything back to its original state without the need to care about it manually.

Just call a single goal to build the release with a minimal higher amount of time required since the plugin works on your local working copy instead of checking out the whole project from scratch. It only builds the release version one time and postpones the installation and deployment steps until every other tasks have finished, such as tagging the SCM or preparing the next development cycle.

Easy to use

Simply add the plugin to your project or any inherited parent configuration and add a dependency to the SCM provider matching your SCM type, ...

<build>
  <pluginManagement>
    <plugins>
      <plugin>
        <groupId>com.itemis.maven.plugins</groupId>
        <artifactId>unleash-maven-plugin</artifactId>
        <version>2.1.3</version>
        <dependencies>
          <dependency>
            <groupId>com.itemis.maven.plugins</groupId>
            <artifactId>unleash-scm-provider-git</artifactId>
            <version>2.0.2</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </pluginManagement>
</build>

... configure the SCM-section of your project to indicate the correct SCM driver ...

<scm>
<connection>scm:git:...</connection>
</scm>
... and call the plugin from command line with all necessary information.
mvn unleash:perform -Dunleash.profiles=... -Dunleash.releaseArgs=...

The plugin will now start with the release on your local working copy. Since it will include all local changes in the relase artifacts it is strongly recommended to release only unchanged local working copies. Better build the releases in a controlled environment such as an integration server.

For more information about the plugin, its goals and options or further information please refer to the Unleash Maven Plugin Wiki.

CI Server support

To support more CI/CD like release processes there is also a Jenkins CI Server integration plugin available which can be installed through the Jenkins Update Center. It is called Unleash Plugin and provides a wrapper for Maven build jobs similar to the M2 Release Plugin.

Simply activate the plugin under the Build Environment section and configure it after your needs. For the provision of the necessary SCM credentials this plugin integrates with the credentials plugin provided by Jenkins.

Give it a try

If you are frustrated about the maven-release-plugin, and even if not, just give it a try and see what it can do for you.

If there are things missing, if you find some bugs or if you need help please use the different issue trackers:

Outlook

I will soon publish another post to give some insight into the plugin internals and behavior such as the default workflow or the embedded rollback feature. There are also some additional features in the pipeline that will come up soon so stay tuned!

If you would like to see some larger or highly project-specific features, such as an SCM provider implementation for an exotic SCM or features that help you to better integrate in your CI/CD process, don't hesitate to get in touch with us. Let's discuss together how itemis can help you get the job done!