0
votes

I have a Maven project that generates a zip file with maven-assembly-plugin on mvn package

MyProy
|--pom
|--src/...
|--target
     |---MyProy-something-1.0.0-SNAPSHOT-zip (contains /1.0.0-SNAPSHOT/...)

I created a Jenkins job and configured a shell script execution as a post step. This script copies the zip to a folder (/something) and unzips it

|-/something
     |---1.0.0-SNAPSHOT
             |---...

This works fine for builds. However I want to do the same when I launch a release. I installed Jenkins release plugin and in "configure release build" I added this tasks:

  1. Before release build -> Maven task mvn release:prepare
  2. After successful release build -> Maven task mvn release:perform
  3. After successful release build -> Execute shell script - Copy zip and unzip.

I see the mvn release:perform execute correctly, for instance with version 1.0.0 but the problem is that when the script (3.) is launched it applies to the next development version (1.0.1-SNAPSHOT) instead of the release version (1.0.0).

1

1 Answers

0
votes

This is how I managed to work around the problem:

  1. Before release build

    1. mvn release:prepare
  2. After successful release build

    1. mvn release:perform
    2. mvc scm:checkout -DscmVersion=${releaseVersion} -DscmVersionType=tag
    3. -f ${WORKSPACE}/target/checkout clean install
    4. Execute shell script with copy and unzip

To sum up, after the release:perform I checkout the brand new tag, execute a clean install in the location of the downloaded tag and finally I execute the script that copies the zip and unzipes it.