Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove -SNAPSHOT from pom.xml

I've just started working with Maven which I'm trying to integrate into a Jenkins job.

The current workflow I'm trying to automate is to merge the dev branch (pom version 2.16.0-SNAPSHOT) into staging which is where we build our release candidates, so here we the versions and sub modules to go from 2.16.0-SNAPSHOT to just 2.16.0.

In 'goals' section of the Maven plugin for Jenkins I've got the following

-o -B release:prepare -DremoteTagging=false install -U

In my Jenkins console during the build I can see it change to the version without the snapshot, but then it changes back? What am I missing?

like image 989
CaledonianCoder Avatar asked Oct 17 '25 16:10

CaledonianCoder


1 Answers

The release:prepare goal performs a handful of tasks. If your only objective is to remove SNAPSHOT from all the module versions you can use Versions Maven Plugin e.g.:

mvn versions:set -DremoveSnapshot=true -DgenerateBackupPoms=false

which should result in version being updated:

...
[INFO] Processing com.something.something:module
[INFO]     Updating parent com.something.something:module
[INFO]         from version 1.0.0-SNAPSHOT to 1.0.0
...
like image 80
Karol Dowbecki Avatar answered Oct 20 '25 06:10

Karol Dowbecki