Maven Release

This plugin is up for adoption! We are looking for new maintainers. Visit our Adopt a Plugin initiative for more information.

This plugin allows you to perform a release build using the maven-release-plugin from within Jenkins.

Project Configuration

On the job configuration page, enable the "Maven release build" under the Build Environment heading and add whatever release goals and options your require.

Performing a Release Build

Follow the "Perform Maven Release" link

and choose "Schedule Maven Release Build".

Using with Nexus Staging

Nexus staging will create a new Stage for each unique IP Address, deploy users and HTTP User agent.

For a particular Jenkins slave the first two will be the same for all builds - so you need to configure Maven to use a unique HTTP User-Agent for the deploy.

To do this make sure your maven settings contains something like the following where the id matches the id for the release repository in the deployment section of your project:

  <server>
    <id>nexus</id>
    <username>my_login</username>
    <password>my_password</password>
    <configuration>
      <httpHeaders>
        <property>
          <name>User-Agent</name>
          <value>Maven m2Release (java:${java.vm.version} ${env.BUILD_TAG }</value>
        </property>
      </httpHeaders>
    </configuration>
  </server>

FAQ

If your build fails with the following:

INFO Executing: mvn clean verify --no-plugin-updates --batch-mode -P null,null
'mvn' is not recognized as an internal or external command,
operable program or batch file.

Then this is a maven bug not a Jenkins plug-in bug.
The solution is to upgrade to version 2.0-beta-8 or later of the maven-release-plugin in your project.

Some users with CVS (cvs+ssh) have reported that a release just hangs while accessing the ssh server (JENKINS-4783). The solution is to use the native CVS client and append "-Dmaven.scm.provider.cvs.implementation=cvs_native" to the release arguments.

The use of this plugin requires that Maven can tag your code.  You may need to use cvs/svn etc from the CI account on the server that is performing the release so the native tools used by maven have the required authentication information.  (this is outside of Jenkins SCM authentication)

Help and Support

For Help and support please use the Jenkins Users mailing list.
To report a bug please check the bug tracker to see if the issue has been reported before creating a new issue.
The comment list below is not monitored.

Version History

0.16.0 (Not yet released)

build from source or download from here if interested

  • Fix JENKINS-35261 SCM username/password env variables don't work with SECURITY-170.
  • Fix JENKINS-16043 NullPointerException with {{FileParameter}}s
  • remove "Default versioning mode" from the UI as it does nothing currently.

0.15.0 (31 July 2019)

Security fixes (announcement)

0.14.0 (31 March 2014)

0.13.0 (23 December 2013)

  • Note the plugin now requires
    • Jenkins 1.509 or higher

 

0.12.0 (25th July 2013)

  • Fix Nexus integration after Sonatype changed public API (again) in 2.6

0.11.0 (4th July 2013)

  • Drop Hudson support. The Hudson community now build and maintain their own fork.
  • Note the plugin now requires
    • Jenkins 1.466 or higher

 

  • Fix Nexus integration after Sonatype changed public API in 2.4

0.10.0 (26th Apr 2013)

0.9.1 (1st Mar 2012)

0.9.0 (13th Feb 2012)

  • Note the plugin now requires
    • Jenkins 1.442 or higher
    • Jenkins LTS 1.424.2 or higher
    • Hudson with the maven-plugin 2.2.1 or higher
  • Fix JENKINS-10127 - M2 Release plugin ignores parameters from a parameterized build (thanks to Dominik Bartholdi for the patch)
  • Fix JENKINS-4690 - Be able to arbitrary paramterize m2 releases (thanks to Dominik Bartholdi for the patch)
  • Fix JENKINS-4500 - Make it possible to select a node to do the release on (together with the nodelabel-plugin) (thanks to Dominik Bartholdi for the patch)
  • Fix JENKINS-4958 - add switch for -DdryRun=true (thanks to Dominik Bartholdi for the patch)

0.8.1 (2nd November 2011)

  • Fix JENKINS-11238 Prevent log spam from when upgrading from an old version with a default versioning mode. (Patch from Richard Mortimer aka oldelvet)
  • Fix JENKINS-10661 Impossible to assign the permission release using project based matrix security

0.8.0 (4th October 2011)

  • Fix JENKINS-8293 - Disable auto refresh for the "Perform" screen to prevent entered password being removed. (Thanks to oldelvet for the patch)
  • Fix JENKINS-7295 JENKINS-5171 - Ability to override the SCM tag to use.
  • Removed ability to specify version for each module (it would faile to work correctly if Jenkins was not building every comit).
  • Removed ability to let maven devide the versioning (the version is needed for things like tooltips).

0.7.1 (10th March 2011)

  • Update plugin to show dependency on Jenkins >= 1.400 (to pick up the fixes below)

0.7.0 (10th March 2011)

  • Fix JENKINS-8289 - enforce dev Version to be a snapshot
  • Fix JENKINS-7837 - release does not use the maven installation it was configured with but whatever is on the path. (NB fixed in core - requires Jenkins >= 1.400)
  • Fix JENKINS-8092 - Maven release plugin cannot find mvn command. (NB fixed in core - requires Jenkins >= 1.400)
  • add permalink to last release.

0.6.1 (17th September 2010)

  • Fix JENKINS-7492 - Fix internal error which occurs under tomcat but not winston due to a double redirect.

0.6.0 (16th September 2010)

  • Fix JENKINS-3876 - Add an icon to release builds.
  • Fix JENKINS-6791 - Scheduling a release will fail silently if a build is already in the queue.

0.5.3 (12th July 2010)

  • Fix NPE when trying to close nexus state.

0.5.2 (8th July 2010)

  • Re-Fix JENKINS-6873 - After scheduling a release build a HTTP 404 error page can be displayed.

0.5.1 (30th June 2010)

  • Fix JENKINS-6887 - NPE during release when version is decided by Maven.
  • Fix JENKINS-6873 - After scheduling a release build a HTTP 404 error page can be displayed.

0.5.0 (25th June 2010)

0.4.0 (26th May 2010)

  • Fix JENKINS-5295 - plugin now allows you to pass SCM username/password to maven.
  • Fixed to work with Nexus 1.5.0 (authorization was not occuring correctly).
  • Added support for specifying an exact version to use across all modules (JENKINS-3429).
  • Added support for specifying scmCommentPrefix (issue #4127 ).
  • Added support for appending the Jenkins username to the scmCommentPrefix (optional).
  • Added config settings (per project) which option(s) should be enabled by default for the Release Action.

0.3.4 (29th December 2009)

  • Fix help pages not showing up when Jenkins runs on a case sensitive file system.
  • Use POST instead of GET to avoid long form URLs.

0.3.3 (21th August 2009)

  • Fix JENKINS-4172 that prevented Jenkins upgrades working correctly.

0.3.2 (24th July 2009)

  • (0.3.0 & 0.3.1 were not released)
  • Jenkins doesn't set the MAVEN_OPTS variable so added a workaround in the plugin JENKINS-3644
  • Added a sepcific security right to allow fine grained release permissions.
  • Added support for closing Nexus Pro staging repository after a release.
  • Added some synchronization to protect against a theoretical race condition.
  • Fix JENKINS-4065 that caused the release plugin to blow up when releases where n-SNAPSHOT.

0.2.0 (23rd March 2009)

  • Added support for Jenkins Security (only users who can perform a manual build can trigger a release build).
  • Release goals now default to -Dresume=false release:prepare release:perform.
  • Added support for specifying exact versions to use.
  • Added support for appending Jenkins build number as maven build number qualifier.
  • Integrated with Jenkins security.  Users require "Build" rights in order to create a release
  • Requires Jenkins >= 1.292.

0.1.0 (16th March 2009)

  • Initial version.
  • Can only use the auto versioning feature of the maven-release-plugin.
  • Tested with a simple single module project, in a master only Jenkins environment.
  • Requires Huson >= 1.288.

TODO

In no order:

  • Integrate with Jenkins security model.
  • Add support for specifying exact versions to use.
  • Add support for auto-versioning with Jenkins build number as maven build number qualifier.
  • Add a sepcific security right to produce a release build.
  • Add support to clean workspace before a release build is performed for the case where Jenkins uses update (JENKINS-3925).
  • work in progress: Add support to clean local maven repository before a release build is performed. Useful for guaranteeing the release is buildable from scratch.
  • Update wiki and add help for latest features.
  • Check compatability with Jenkins master/slave.
  • Check compatability with multi-module projects.
  • Add some feedback onto the build history to show release builds (like the Release Plugin).
  • Get jenkins to recognize the releases as build artifacts.
  • See if we can do something in the freestyle for maven builds.
  • Nexus support
    • rewrite support from ground up to avoid closing incorrect repository
    • Add support for closing nexus pro staging repos on succesful build completion.
    • Add support (if possible) for changing the User agent to support grouping into a nexus pro staging repo.
    • Add support for removing a nexus pro staging repo on a failed build.
    • Add support for auto promoting a nexus pro staging repo on a successful build.