I have multimodule maven project and want to automate part of release preparing. Before release I increase the version of changed module A, and because I have module B depends on A, I also need to increase version of B. I know that there is "versions" and "release" maven plugins, but they doesn't cascade the update of version . Is it possible to make update of B version automaticly too?
Some additions to make it clear: We don't use version of parent module, so i don't need to update it.
Before version bump:
parent module (1.0)
|
|-- A module (0.01.00)
|-- B module (0.02.00)
After version bump:
parent module (1.0)
|
|-- A module (0.01.01)
|-- B module (0.02.01)
release
plugin have update-versions
goal and autoVersionSubmodules option that sets submodules versions to parent project version.
Usage example here.
Now, if you have dependencies between your submodules (Module B
depends on Module A
), they won't be updated by release
plugin.
To work this out you can use ${project.version}
when defining dependency to Module A
in Module B
's pom.xml
.
For example (in Module B
's pom.xml
):
<dependency>
<groupId>test</groupId>
<artifactId>module-a</artifactId>
<version>${project.version}</version>
</dependency>
(this will work because both Module A
and Module B
versions are the same and derived from parent project version)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With