How to make cascading version installed in maven?

I have a multi-module maven project and you want to automate part of the release preparation. Before release, I increase the version of the modified module A, but because I have module B, it depends on A, I also need to increase version B. I know that there are "versions" and "release" maven plugins, but they are not an update cascade version. Is automatic updating of version B possible too?

Some additions to understand: We do not use the version of the parent module, so I do not need to update it.

Before release:

parent module (1.0) | |-- A module (0.01.00) |-- B module (0.02.00) 

After the bump version:

 parent module (1.0) | |-- A module (0.01.01) |-- B module (0.02.01) 
+6
source share
1 answer

release plugin has an update-versions target and an autoVersionSubmodules parameter, which sets the versions of submodules to the parent version of the project.

Usage example here .

Now, if you have dependencies between your submodules ( Module B depends on Module A ), they will not be updated by the release plugin.

To solve this problem, you can use ${project.version} when defining a dependency on Module A in Module B pom.xml .

For example (in Module B pom.xml ):

  <dependency> <groupId>test</groupId> <artifactId>module-a</artifactId> <version>${project.version}</version> </dependency> 

(this will work because both versions of Module A and Module B same and are derived from the parent version of the project)

+4
source

All Articles