user1111871
user1111871

Reputation: 147

Maven Release Plugin For Multi-module projects - Updating dependency versions

We have a multiple multi-module projects set up i.e:

>    Proj1
>      parent
>      mod1
>      mod2
>     Proj2
>      parent
>      mod1
>      mod2

...

Proj2 depends on Proj1. And so part of the pom.xml for Proj2 would be

>     <dependencies>
>     ....
>     <dependency>
>       <groupId>${project.groupId}</groupId>
>       <artifactId>ABCXYZ</artifactId>
>       <version>${Proj1.version}</version>
>     </dependency>
>     </dependencies>
>     <properties>
>       <Proj1.version>1.0.0.RELEASE</Proj1.version>
>     </properties>

The question now is, is it possible using the maven release plugin for me to automate the release of this Proj2 such that the new release of Proj1 is picked up and replaced in the <Proj1.version> tags. When I tried the regular mvn release:prepare-with-pom I got a prompt for the dependencies update but when I entered the new version, it replaced it in the <version> tag which isn't desired.

Thanks for any input

Upvotes: 2

Views: 2356

Answers (1)

Guillaume Darmont
Guillaume Darmont

Reputation: 5018

You may have a look to the update-properties goal of the versions-maven-plugin. I haven't use it for a while, it was working fine.

Your release workflow would be :

  • Release Proj1
  • Update <Proj1.version> of Proj2 using versions-maven-plugin
  • Commit Proj2
  • Release Proj2

Upvotes: 2

Related Questions