Release faster – announcing Maven Promote Plugin

Hopefully you have Continuous Integration set up for your Java project in a way that Jenkins/Teamcity/whatnot triggers a build as soon as you push to GitHub, or whatever VCS you may be committing to. As part of that build, or triggered by that build, you run a bunch of automated tests and then you or some other part of your team does manual testing of the produced artifacts (WAR/JAR) – right?

Then once everyone is happy with the results you want to perform a release. Assuming you’re using Maven, that means running a build in the CI system using the Maven Release Plugin. This will build the artifacts again and run the tests again. Twice even; prepare + perform. (Axel Fontaine has previously blogged about this nuisance and suggested a workaround that he calls Maven Releases on Steroids.)

In this era of agile and frequent releases, this seems like a waste of time, don’t you think? And when you have discovered that critical bug in production, having to wait another 20/40/120/whatever minutes for the release build after the fix has already been verified can be quite frustrating.

Don’t you wish there was a way to just promote the already verified artifacts, to say “These are the ones I want to release”, and have them deployed to your Maven release repository (such as Nexus)?

Well now there is!

Available in Maven Central is now the Maven Promote Plugin that allows you to “promote” your SNAPSHOT build into a release, and have it SCM tagged and deployed the regular Maven way.

For detailed instructions how to configure your Maven pom.xml and Jenkins, see the README for promote-maven-plugin on GitHub.

While the initial version of the plugin may not be as feature rich and/or intelligent as it could be, it gets the job done and on my day job we have been releasing to production with this plugin for months now, which is why I’ve decided to promote it to 1.0.0 GA.

  • David Smith

    I gave your plugin a try, looks good. It took quite a while for me to get my head around the doco.

    Does this plugin close the staging repo in maven central?
    I can see my artifacts in the staging repo, they have a status of open. Not sure if they auto close, I’ll have to check that out. I guess if I wait til tomorrow I’ll find out.

    • Hi David. The itself plugin doesn’t perform any of the actual release actions, it only orchestrates other plugins to act on existing artifacts. So whether the staging repo is closed or not, depends on how that plugin is configured.

      If needed, you should be able to add additional actions to the preparationGoals, like so:

      promote:artifacts plugin1:action1 plugin2:action2 deploy:deploy

  • Paul Reid

    Very interesting blog and project. Do you have any ideas on how I might be able to incorporate this into a project which uses Gradle?