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
<groupId>com.mdm</groupId> 
<artifactId>mdm</artifactId> 
<version>${mdm.version}</version> 
<packaging>pom</packaging>

In sub module pom, we had this

<parent>
    <groupId>com.mdm</groupId>
    <artifactId>integration-main</artifactId>
    <version>${mdm.version}</version>
    <relativePath>../pom.xml</relativePath> 
</parent>

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.

http://stackoverflow.com/questions/2104432/maven-replace-property-in-project-pom-file-when-installing-in-repository

I replaced the property placeholder with its real version, which is 1.9.4.4 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.

http://stackoverflow.com/questions/5726291/updating-version-numbers-of-modules-in-a-multi-module-maven-project

No comments:

Post a Comment