0

I am trying to release code using Jenkins. I have x.x-SNAPSHOT at master, and I am using master for my release.

release:prepare release:perform -DreleaseVersion=$RELEASE_VERSION -DdevelopmentVersion=$DEVELOPMENT_VERSION 

I am using the above command in my jenkins build step. However, my problem is the release plugin is always releasing x.x-SNAPSHOT to my repository. Can you please highlight what am I doing wrong?

This was the reference for me : http://maven.apache.org/maven-release/maven-release-plugin/examples/non-interactive-release.html

Edit : My bad, missed mentioning few details :

DEVELOPMENT_VERSION 2.1-SNAPSHOT
RELEASE_VERSION 2.1

I am injecting these variables and I have confirmed after the execution that these values are getting injected indeed.

[INFO] ------------------------------------------------------------------------
[INFO] Building app 2.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-release-plugin:2.3.2:prepare (default-cli) @ app ---
[INFO] Verifying that there are no local modifications...
[INFO]   ignoring changes on: **/pom.xml.releaseBackup, **/pom.xml.next, **/pom.xml.tag, **/pom.xml.branch, **/release.properties, **/pom.xml.backup
[INFO] Executing: /bin/sh -c cd /data/jenkins/workspace/app-master && git status
[INFO] Working directory: /data/jenkins/workspace/app-master
[INFO] Checking dependencies and plugins for snapshots ...
[INFO] Transforming 'app'...
[INFO] Not generating release POMs
[INFO] Executing goals 'clean verify'...
[INFO] [INFO] Scanning for projects...
[INFO] [INFO]                                                                         
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Building app 2.1
[INFO] [INFO] ------------------------------------------------------------------------

This is when I run release:prepare. Then the tag is checked out:

[INFO] --- maven-release-plugin:2.3.2:perform (default-cli) @ app ---
[INFO] Checking out the project to perform the release ...

While performing release:

[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Building app 2.1-SNAPSHOT
[INFO] [INFO] ------------------------------------------------------------------------

And the tag does have <version>2.1-SNAPSHOT</version>

NewUser
  • 3,729
  • 10
  • 57
  • 79
  • you mean to say that you are passing 1.0- Snapshot in the code and why jenkins is making the jar with the aforementioned snapshot? – salsinga Feb 06 '20 at 14:01
  • Are you using the correct version in `$RELEASE_VERSION` and in `$DEVELOPMENT_VERSION ` ? – khmarbaise Feb 06 '20 at 14:02
  • @khmarbaise - Thank you for highlighting, I did miss mentioning about these variables. – NewUser Feb 06 '20 at 14:07
  • @salsinga - That value was an example.. Now modified to be more clear – NewUser Feb 06 '20 at 14:08
  • Have you checked the log file of Jenkins furthermore have you tried to do that locally on plain command line without Jenkins first...Have you correctly configured the scm/developerConnection etc. ? – khmarbaise Feb 06 '20 at 14:14
  • 1
    @khmarbaise - scm, developerConnection, repositories are configured correctly. Testing locally is not possible due to missing creds. I will try with DryRun enabled. – NewUser Feb 06 '20 at 14:19
  • I would try to debug the issue by replacing $RELEASE_VERSION by the hard-coded value `2.1` in your command. – J Fabian Meier Feb 06 '20 at 14:40
  • @JFMeier - updated my question with further observations.. Can you please have a look if possible. – NewUser Feb 06 '20 at 15:26
  • I suspect that you somehow interchanged the values of $RELEASE_VERSION and $DEVELOPMENT_VERSION. For tests, I would get rid of both variables and hardcode the versions. – J Fabian Meier Feb 06 '20 at 15:32
  • @JFMeier I got rid of the variables completely. I hardcoded to 2.1 and 2.2-SNAPSHOT just to be sure what is getting picked up. The result was 2.1-SNAPSHOT getting uploaded again :( – NewUser Feb 06 '20 at 16:14
  • There are other things wrong ...Please make an example project on Github or a like and describe how you execute Maven etc... ?... – khmarbaise Feb 06 '20 at 16:25
  • See https://stackoverflow.com/questions/15166781/mvn-releaseprepare-not-committing-changes-to-pom-xml. – Dibakar Aditya Feb 06 '20 at 18:45

0 Answers0