Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven release:branch

Tags:

maven

I have a maven multi module project.

When the code is development complete, we would want to write a branch build job in Jenkins which branches the code, increment the pom versions in the trunk, and remove the -SNAPSHOT from the pom versions in the branch.

So, if the trunk is 2.2-SNAPSHOT, by the end of the operation, the trunk should be 2.3-SNAPSHOT, and the newly created branch should have poms with 2.2.

When I use release:branch the trunk is getting updated but it's not removing the -SNAPSHOT from the poms in the branch.

Please let me know if you have any ideas of achieving this.

Thanks in advance.

like image 730
anvk Avatar asked Nov 05 '22 13:11

anvk


1 Answers

From Maven Release plugin: Create a branch

By default, the POM in the new branch keeps the same version as the local working copy, and the local POM is incremented to the next revision. If you want to update versions in the new branch and not in the working copy, run:

mvn release:branch -DbranchName=my-branch -DupdateBranchVersions=true -DupdateWorkingCopyVersions=false

Note: This can be useful if you want to create a branch from a tag

As an alternative, you might want to try the Versions Maven plugin:

mvn versions:set versions:commit -DnewVersion=2.2.0

You would still need to create the branch by hand though...

like image 164
JBert Avatar answered Nov 09 '22 12:11

JBert