Thursday, July 19, 2012

Updating Version in Maven pom.xml

Sure you can do it manually. And it worked flawlessly until now. Wait until you have a multi-module project and yet dared to do it manually. Sooner than later you will see you have made a typo -- you renamed the version to 1.2.3-SHAPSHOT

Anyway, the most common Google search results into mvn release:update-revisions which requires the pom.xml to be in SNAPSHOT revision, and it's release, you may not want to perform a release.

A better (and correct) alternative is to use Maven Versions plug-in. It updates the versions of submodules too. Here is how to use it
mvn versions:set -DnewVersion=1.2.3-SNAPSHOT

1 comment: