Maven Release: Branch

I have a project with several maven modules.

When the code is complete, we need to write a branch building task in Jenkins that passes the code, increments the pom versions in the trunk and removes -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 updated, but does not remove -SNAPSHOT from the priests in the branch.

Please let me know if you have any ideas to achieve this.

Thanks in advance.

+4
source share
1 answer

From Maven Release Plugin: Create a Branch

By default, the POM in the new branch stores the same version as the local working copy, and the local POM increases to the next version. If you want to update versions in a new branch, and not in a 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.

Alternatively, you can try the Maven plugin versions :

mvn versions: install versions: commit -DnewVersion = 2.2.0

You still need to create the branch manually, though ...

+1
source

All Articles