Creating a branch involves the following release phases:
To create a branch execute this command:
mvn release:branch -DbranchName=my-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
You may want to specify the versions to use on the command line. This can be useful for example if you are running the release in non-interactive mode. The branch goal can use the same properties used by the prepare goal for specifying the versions to be used.
mvn --batch-mode release:branch -DbranchName=my-branch-1.2 -Dproject.rel.org.myCompany:projectA=1.2 \ -Dproject.dev.org.myCompany:projectA=2.0-SNAPSHOT
In this example, the POM in the new branch will be set to the version 1.2-SNAPSHOT, and the local POM will be set to the version 2.0-SNAPSHOT.