Wednesday, April 13, 2016

Maven Auto Increment Version

Maven update-versions is a handy goal to increment version number of a project. This is especially useful for large multi-module maven projects.

mvn release:update-versions
The above command prompts for the new version for each module in the project. The prompts can be avoided by using the option autoVersionSubmodules. This will set each module version to be same as the parent POM.
mvn releae:update-versions -DautoVersionSubmodules=true
The goal can be run in non-interactive mode using batch-mode.
mvn --batch-mode release:update-versions
Above command will auto increment the version without prompts. A specific version can also be specified:
mvn --batch-mode release:update-versions -DdevelopmentVersion=1.1-SNAPSHOT

No comments: