M2 Release Plugin

Plugin Information

Plugin ID m2release
Latest Release 0.10.0-h-1
Latest Release Date Aug 30, 2012
Sources Github
Support Eclipse Hudson Forum
Issue Tracking Eclipse Bugzilla

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

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 Hudson 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 hudson 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 (issue #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 Hudson SCM authentication)

Version History

0.7.0+ (Not yet released)

See the Jenkins WIKI for info.

  • Fix issue #7837 - release does not use the maven installation it was configured with but whatever is on the path.

0.6.1 (17th September 2010)

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

0.6.0 (16th September 2010)

  • Fix issue #3876 - Add an icon to release builds.
  • Fix issue #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 issue #6873 - After scheduling a release build a HTTP 404 error page can be displayed.

0.5.1 (30th June 2010)

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

0.5.0 (25th June 2010)

  • Fix issue #6630 - plugin closes incorrect nexus stage

0.4.0 (26th May 2010)

  • Fix issue #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 (issue #3429).
  • Added support for specifying scmCommentPrefix (issue #4127 ).
  • Added support for appending the Hudson 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 Hudson runs on a case sensitive file system.
  • Use POST instead of GET to avoid long form URLs.

0.3.3 (21th August 2009)

  • Fix issue #4172 that prevented hudson upgrades working correctly.

0.3.2 (24th July 2009)

  • (0.3.0 & 0.3.1 were not released)
  • Hudson doesn't set the MAVEN_OPTS variable so added a workaround in the plugin issue #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 issue #4065 that caused the release plugin to blow up when releases where n-SNAPSHOT.

0.2.0 (23rd March 2009)

  • Added support for hudson 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 hudson build number as maven build number qualifier.
  • Integrated with Hudson security.  Users require "Build" rights in order to create a release
  • Requires Hudson >= 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 hudson environment.
  • Requires Huson >= 1.288.

TODO

In no order:

  • Integrate with Hudson security model.
  • Add support for specifying exact versions to use.
  • Add support for auto-versioning with hudson 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 hudson uses update (issue #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 Hudson master/slave.
  • Check compatability with multi-module projects.
  • Add some feedback onto the build history to show release builds (like the Release Plugin).
  • Get hudson to recognise 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.

Labels:

plugin-buildwrapper plugin-buildwrapper Delete
plugin-maven plugin-maven Delete
tier3-compat-plugin tier3-compat-plugin Delete
Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.
  1. May 22, 2009

    Jason Zaugg says:

    When I originally tried this plugin, I always hit this error. After upgrading to...

    When I originally tried this plugin, I always hit this error. After upgrading to Maven 2.1.0 and Hudson 1.306, it works perfectly.

    [INFO] Checking out the project to perform the release ...
    [INFO] Executing: cmd.exe /X /C "svn --non-interactive checkout http://chzrhfpmon01/repos/efg-commons/efg-commons-io/tags/efg-commons-io-0.4 d:\work\hudson_home\jobs\efg-commons-io\workspace\efg-commons-io\target\checkout"
    [INFO] Working directory: d:\work\hudson_home\jobs\efg-commons-io\workspace\efg-commons-io\target
    [INFO] Executing goals 'deploy site-deploy'...
    [INFO] [INFO] Scanning for projects...
    [INFO] [INFO] ------------------------------------------------------------------------
    [INFO] [INFO] Building Maven Default Project
    [INFO] [INFO]    task-segment: [deploy, site-deploy]
    [INFO] [INFO] ------------------------------------------------------------------------
    [INFO] [INFO] Ignoring available plugin update: 2.5 as it requires Maven version 2.0.9
    [INFO] [INFO] ------------------------------------------------------------------------
    [INFO] [ERROR] BUILD ERROR
    [INFO] [INFO] ------------------------------------------------------------------------
    [INFO] [INFO] Cannot execute mojo: resources. It requires a project with an existing pom.xml, but the build is not using one.
    
    
  2. May 25, 2009

    Gabriel Falkenberg says:

    We got the following error while trying to use the M2-release plugin: [INFO]...

    We got the following error while trying to use the M2-release plugin:

    [INFO] Unable to commit files
    Provider message:
    The svn command failed.
    Command output:
    svn: Commit failed (details follow):
    svn: OPTIONS of 'http://example.com/test-repo/branches/release_1_1': authorization failed (http://example.com)
    

    The solution was to login as the user running Hudson and performing a couple of svn commands (such as list) from the command line on the repo in question. This is mentioned (performing some svn commands manually) on the page: http://wiki.hudson-ci.org/display/HUDSON/Hosting+plugins but with no explanation of why this might solve anything. It might be that this caches the svn credentials for the user and maybe the release plugin forks a new process which does not use Hudson's saved svn credentials?

  3. May 28, 2009

    darren hartford says:

    m2 release plugin 0.20 on hudson 1.288 breaks, and another symptom is when you c...

    m2 release plugin 0.20 on hudson 1.288 breaks, and another symptom is when you configure a project with the release plugin, the configure page breaks where the release section just was, and you no longer have the ok/submit button.

    upgrading hudson to 1.307 corrects this issue.(this is all in the above notes btw).

  4. Jul 08, 2009

    Giancarlo Rosso says:

    Do you think it would be difficult to implement version tagging (not the default...

    Do you think it would be difficult to implement version tagging (not the default one).

    Now I have to specify it as a -Dtag=tag in configuration.

    Thanks.

  5. Sep 15, 2009

    pringles says:

    Can dependencies be specified using thisrelease plugin.like, you can trigger a ...

    Can dependencies be specified using thisrelease plugin.like,

    you can trigger a release once a dependent one is released ?

  6. Sep 25, 2009

    Julien HENRY says:

    Please add a way to specify scmCommentPrefix like in Continuum. In my organisati...

    Please add a way to specify scmCommentPrefix like in Continuum. In my organisation we have a pre commit hook that enforce a specific bug tracker id in every SVN commit message. So the release plugin is not able to commit/tag without this information.

    Thanks

  7. Nov 06, 2009

    Bertrand Gressier says:

    It will be very good, if plugin begin to make a svn up before run release.

    It will be very good, if plugin begin to make a svn up before run release.

  8. Nov 06, 2009

    Bertrand Gressier says:

    I have a bug if my version is not "standard" : 1.3.5-4-SNAPSHOT In hudson log I...

    I have a bug if my version is not "standard" : 1.3.5-4-SNAPSHOT

    In hudson log I have this message :
    Nov 6, 2009 3:32:31 PM hudson.ExpressionFactory2$JexlExpression evaluate
    WARNING: Caught exception evaluating: it.computeNextVersion(m.version). Reason: java.lang.NumberFormatException: For
    input string: "5-3"
    java.lang.NumberFormatException: For input string: "5-3"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
    at java.lang.Integer.parseInt(Integer.java:456)
    at java.lang.Integer.parseInt(Integer.java:497)
    at org.jvnet.hudson.plugins.m2release.M2ReleaseAction.computeNextVersion(M2ReleaseAction.java:98)

    And when the job is running, I have this error log :
    [INFO] Can't run goal clean verify

    java.io.IOException: mvn: not found

    Thanks

  9. Nov 20, 2009

    Edgar Vonk says:

    Thanks for this nice plugin. We have an issue however when we want to release o...

    Thanks for this nice plugin.

    We have an issue however when we want to release one of our projects which has a large (>30) number of modules in it. When you select 'Specify release version(s)' the URL that the plugin generates (apparently it creates a GET request instead of a POST request) becomes too large:

    Request-URI Too Large
    
    The requested URL's length exceeds the capacity limit for this server.
    

    Is it possible for the plugin to use a POST request instead?

  10. Dec 31, 2009

    fabrice says:

    thanks for the plugin However why do you not propose to use SCM conf job for ...

    thanks for the plugin

    • However why do you not propose to use SCM conf job for releasing instead of forcing user to declare SCM parameters in the pom.xml ?
    • BIG PROBLEM : you tag on the SCM with the job name suffixed by the release number. WHY ? Ex :
      [INFO] Tagging release with the label test-14-standard-web-1_0_0_0_3...

    Instead of tagging my test-14-standard-web with v1_0_0_0_3 as requested in the input release field before the release action.

    So because our SCM check the tag syntax the action is rejected :-(

    It is not the plugin but maven-release-plugin that is responsible of this

    (http://jira.codehaus.org/browse/MRELEASE-159, http://jira.codehaus.org/browse/MRELEASE-150)

    but How can I configure it

    I must give the -Dtag=v1_0_0_0_3 parameter to release:prepare but it will be fine if M2 release plugin could display on the action page, a input field with the SCM tag (with a default value)

    Can I create a issue ?

  11. Jan 08, 2010

    Abhishek Chaturvedi says:

    anyone tried with perforce?? i am not able to use it...its failing while commit.

    anyone tried with perforce?? i am not able to use it...its failing while commit.

  12. Jan 28, 2010

    Baptiste MATHUS says:

    Evaluating this plugin, I miss something that seems to me it would be not very d...

    Evaluating this plugin, I miss something that seems to me it would be not very difficult do add. In fact, most of the time, we release a whole hierarchy of multimodule projects with the same version for each module. We use the -DautoVersionSubModules=true option. At the moment, if I say I want to specify the versions, the plugin shows every single modules.

    To be able to use the hudson-m2 release plugin, it should add an additional option to say that the version is the same (the option above). This way, there would only one field for releaseVersion, and one for devVersion, not for each module.

    I could try and have a look at the plugin to do that myself. Do you think it would be difficult, and would you consider it a good improvement or would you reject it?

    Cheers.

  13. Jan 29, 2010

    Simon Buss says:

    Hi James, we just switched to hudson and would really like to use your plugin f...

    Hi James,

    we just switched to hudson and would really like to use your plugin for our releases. Your ToDo list says "

    • Get hudson to recognise the releases as build artifacts.

    "

    Can you already foresee when you'll be able to get to that issue? To us it would be the one and most important issue to take the plugin into consideration for regular usage. So we would REALLY appreciate it being solved. BTW: I didn't find it in your JIRA Issues linked above, should I add it?

    The most appropriate way probably was to have hudson point to the maven repo where the released artifacts are deployed to. So maybe hudson/the plugin could just parse the m2 settings.xml and concatenate it with maven release arftifact urls?

    Thanks in advance for short feedback!

    Best regards,

    Simon

  14. Feb 09, 2010

    Daniel Triphaus says:

    Hi, ist it possible to get an RSS-Feed for releases via Hudson? There are RSS-F...

    Hi,

    ist it possible to get an RSS-Feed for releases via Hudson? There are RSS-Feeds from Hudson for failed builds and all builds, but i would like to have an RSS-Feed only for release-versions.

    Best regards,

    Daniel

  15. Feb 09, 2010

    Matt Pierce says:

    I'm not actually using this plugin, but just running the maven-release-plugin by...

    I'm not actually using this plugin, but just running the maven-release-plugin by putting release:prepare and release:perform in the goals and options of my hudson build when I want to release.

    When I run a hudson build of a maven project using the release plugin, my primary artifact (the war file for the webapp I'm building) no longer gets saved as an artifact in hudson.  It does get created and deployed correctly to my releases repository.  If I run a regular build without releasing I get the war file as a hudson artifact.  If I add 'package' somewhere in the goals line with release:prepare and release:perform I get a war file artifact, but it is not the release version--it is either of the pre-release SNAPSHOT or the post-release SNAPSHOT (depending on where I put the package goal relative to the release goals).

    Is there a way to release and have the release-version war file available in Hudson as an artifact?  Will using this plugin accomplish that?

  16. May 28, 2010

    Bertrand Gressier says:

    This plugin is a good work !! Can you add a button to rollback the release (com...

    This plugin is a good work !!

    Can you add a button to rollback the release (command : release:rollback) if the release is failed.
    you can detect if a rollback file exist in the workspace.

    today we must append a batch task to execute the command.

    Bertrand

  17. Nov 29, 2010

    Shadow de Coutemeier says:

    Great plugin. It is working ok for me. But I miss integration with Sonar, a new ...

    Great plugin. It is working ok for me.
    But I miss integration with Sonar, a new option in Perform Maven release, something as:

    Sonar: Launch an analisys after release: [ ]

    If the check is on then will be launch a Sonar analisys, with the version generated (not the snapshot, the version release).
    And the configuration, in the line of de Sonar plugin for Hudson, no need in pom.xml.

  18. Dec 07, 2010

    Jim Daniel says:

    Is it possible to add parameterized functionality to the plug-in?  Paramete...

    Is it possible to add parameterized functionality to the plug-in?  Parameters that can be set in Release Plugin at run time and be accessible in the build proper. 

  19. Dec 08, 2010

    Lars Fischer says:

    Hello, is it possible to access the resulting version values as parameter for t...

    Hello,

    is it possible to access the resulting version values as parameter for the "Release goals and options" field?

    I need to specify a different SCM tag and would like to use something like this:

    -Dtag=myspecialvalue-${releaseVersion} -Dresume=false release:prepare release:perform
    

    This should result in a scm tag like "myspecialvalue-0.0.1"

    1. Mar 03, 2011

      Mike Dalrymple says:

      I noted that Hudson is initiating the command with a property like -Dproject.re...

      I noted that Hudson is initiating the command with a property like -Dproject.rel.com.example:my-artifact-id=1.0.1. Using the following plugin configuration:

      <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <configuration>
              <tag>REL-${project.rel.com.example:my-artifact-id}</tag>
          </configuration>
      </plugin>

      Resulted in a tag of REL-1.0.1.

  20. Feb 28, 2011

    daniel nitzan says:

    Hi, Is there a way to resolve SNAPSHOT dependencies, like when using maven-rele...

    Hi,

    Is there a way to resolve SNAPSHOT dependencies, like when using maven-release-plugin directly?

    By that I refer to the interactive prompt in which I can choose a release version and a next development version for a snapshot dependency.

    I did not see this functionality in the hudson plugin though, any ideas?

    Thanks,

    Daniel

  21. Nov 27, 2012

    vijay says:

    Hi, I am using Hudson 2.1.2 version.Whenever I am trying to install M2 Release ...

    Hi,

    I am using Hudson 2.1.2 version.Whenever I am trying to install M2 Release Plugin,getting the following error.

    Can anybody help me out of this problem.

    Status Code: 500

    Exception:
    Stacktrace: java.lang.NullPointerException
    at hudson.model.UpdateSite$Plugin.getNeededDependencies(UpdateSite.java:580)
    at hudson.model.UpdateSite$Plugin.deploy(UpdateSite.java:622)
    at hudson.PluginManager.doInstall(PluginManager.java:539)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:282)
    at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:149)
    at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:88)
    at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:103)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:561)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:646)
    at org.kohsuke.stapler.MetaClass$3.doDispatch(MetaClass.java:167)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:561)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:646)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:477)
    at org.kohsuke.stapler.Stapler.service(Stapler.java:159)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:45)
    at winstone.ServletConfiguration.execute(ServletConfiguration.java:249)
    at winstone.RequestDispatcher.forward(RequestDispatcher.java:335)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:378)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:94)
    at org.hudsonci.servlets.internal.ServletRegistrationFilterAdapter.doFilter(ServletRegistrationFilterAdapter.java:180)
    at org.hudsonci.servlets.internal.ServletRegistrationFilterAdapter.doFilter(ServletRegistrationFilterAdapter.java:148)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:97)
    at org.hudsonci.servlets.internal.ServletRegistrationFilterAdapter.doFilter(ServletRegistrationFilterAdapter.java:180)
    at org.hudsonci.servlets.internal.ServletRegistrationFilterAdapter.doFilter(ServletRegistrationFilterAdapter.java:148)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:97)
    at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:86)
    at winstone.FilterConfiguration.execute(FilterConfiguration.java:195)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:368)
    at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:47)
    at winstone.FilterConfiguration.execute(FilterConfiguration.java:195)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:368)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
    at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:166)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessingFilter.java:173)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
    at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:66)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
    at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
    at winstone.FilterConfiguration.execute(FilterConfiguration.java:195)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:368)
    at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
    at winstone.FilterConfiguration.execute(FilterConfiguration.java:195)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:368)
    at winstone.RequestDispatcher.forward(RequestDispatcher.java:333)
    at winstone.RequestHandlerThread.processRequest(RequestHandlerThread.java:244)
    at winstone.RequestHandlerThread.run(RequestHandlerThread.java:150)
    at java.lang.Thread.run(Thread.java:662)

    Thanks in advance.