Jenkins maven-release-plugin

19,894

Solution 1

Maybe you should consider taking a look at this article here: https://pragmaticintegrator.wordpress.com/2014/05/12/running-the-maven-release-plugin-with-jenkins/

With Jenkins Release plugin you could customize your release workflow to add specific steps once your M2 release is done.

Solution 2

We have a Jenkins deployment for each environment (dev, qa, prod). We move the same artifacts across all environments using Promoted Builds, Copy Artifact, and Parameterized Trigger plugins. To see how they work together, read this post (How to promote a specific build number from another job in Jenkins?)

As per the release process, instead of Maven Release plugin, use Maven Promote plugin (http://java.jiderhamn.se/2016/05/04/announcing-maven-promote-plugin/) to release the artifact that is already built and tested (there are a lot of articles on maven release plugin's drawbacks). You can still use Jenkins M2 Release Plugin, but in it's configuration, Release goals and options, call mvn release:clean promote:prepare release:prepare instead. For more details: https://github.com/mjiderhamn/promote-maven-plugin/issues/2

Share:
19,894
AKS
Author by

AKS

A Quote on "Quote(s)": For every quote, there exists at least one contradictory quote. - AKS

Updated on June 04, 2022

Comments

  • AKS
    AKS almost 2 years

    In Jenkins (latest), Maven 3.0.x, I have a project (Java source code).

    I'm using M2 release plugin, which provides a nice "Perform Maven Release" button on the Jenkins job (left hand side pane on the Jenkins job's dashboard). Behind the scene / in Jenkins job's configuration, it calls: release:prepare release:perform goals.

    When I'm click on "Perform Maven Release", it does it's job successfully (builds from 1.0.0-SNAPSHOT, run tests && if successful, make changes to pom.xml and put version as 1.0.0 as version ID, perform some more verification and make changes to pom.xml (what maven-release-plugin checks are etc), commit this change in version control, tag it with 1.0.0 as a "TAG" in version control, change pom.xml again to use 1.0.1-SNAPSHOT and commit it, then checkout from that tagged 1.0.0 release version tag which we just created, checkout it under /target/checkout folder, build relase 1.0.0 artifacts (jar/war/pom etc) and finally deploys it to the repository which you'd have mentioned inside ..... ... section.

      <distributionManagement>
       <repository>
         <id>dev-artifactory</id>
             <url>http://1.2.3.15:8081/artifactory/libs-release-local/</url>
       </repository>
       <snapshotRepository>
         <id>dev-artifactory</id>
             <url>http://1.2.3.15:8081/artifactory/libs-snapshot-local/</url>
       </snapshotRepository>
      </distributionManagement>
    

    What I need is:

    1) How can I make "Perform Maven Release" process to call a deployment to a server once x.x.x release artifacts are generated by the process above and run some Integration tests. This should happen before deployment of artifacts to a binary repository (Artifactory/Nexus) is performed by maven-release-plugin process. i.e. if you are putting artifacts in a release repository, then non-unit tests are also successful (not that artifacts are in libs-release-local repository in Artifactory and Integration tests are yet to be launched.

    OR do I need to change ... to use libs-snapshot-local (Artifactory repository) and then run IT tests and finally if those tests are successful, move 1.0.0 release artifacts from libs-stage-local repository to libs-release-local repository.

    I know I can put maven-release-plugin related settings in Maven's user's .m2/settings.xml (user global) or at M2_HOME/.m2/settings.xml (global) but at this point, that's not the question.

  • Panda TG Attwood
    Panda TG Attwood about 7 years
    The first link has rotted, here's an archived version of it: web.archive.org/web/20160405090645/http://labs.bsb.com/2014/‌​02/…