mvn release:branch - How to specify branch version using batch mode?
I've just started using maven for tagging, releasing and rolling up versions for the next development cycle and most of the time it works like charm. Me like.
However I would like to use the release:branch goal to at the same time create a maintenance branch with only a minor version rollup, and when I specify the version of the branch as an argument maven doesn't seem to pick it up. Why?
I've tried both with the -DreleaseVersion=<version>
option specified in the docs and the -Dproject.rel.org.example:artifact=&l开发者_如何学JAVAt;version>
used in the example.
The version of maven I'm using is 2.2.1 and the maven-release-plugin version is 2.1.
As it turns out -DreleaseVersion works just fine, but there are several ways for the svn configs in the pom to end up out of sync and if it is, specifying version just won't work.
From http://maven.apache.org/maven-release/maven-release-plugin/branch-mojo.html#releaseVersion
releaseVersion:
Specify the new version for the branch. This parameter is only meaningful if updateBranchVersions = true
Therefore for the mvn release:branch use-case you need to set both releaseVersion AND updateBranchVersions
e.g.
mvn --batch-mode release:branch -DbranchName=YOUR_BRANCH_NAME -DupdateBranchVersions=true -DreleaseVersion=YOUR_VERSION
精彩评论