Sunday, March 23, 2014

maven multiple projects version

In one of my projects, we had some bad settings in maven.
In parent pom, we had this

In sub module pom, we had this


The property placeholder should not be used in these sections. Maven won’t replace them when install the pom into the repository.

The property placeholder can only be used in the dependency section.

I replaced the property placeholder with its real version, which is for now.

In future, if we need upgrade the version for all modules, the commands below can change all the versions in all pom files.

Use versions:set from the versions-maven plugin:
mvn versions:set -DnewVersion=2.5.0
It will adjust all pom versions, parent versions and dependency versions in a multi-module project.
If you made a mistake, do
mvn versions:revert 
afterwards, or
mvn versions:commit 
if you're happy with the results.

No comments:

Post a Comment