0
votes

I have a big multi-module maven project (tens of modules, 4 nesting levels).

Every module has it's own semantic version (can be SNAPSHOT or not).

I want to find the way to bump every module major version automatically with one command or script to avoid changes in every module.

So I have for example

parent POM (1.2.3-SNAPSHOT)
|-- api-module (3.4.5)
|-- impl-module (5.6.7-SNAPSHOT)
|-- another-parent-module (1.0.1-SNAPSHOT)
|--|--sub-module1 (1.2.3)
|--|--sub-module2 (2.3.4)

and after bumping I want to have

parent POM (2.0.0-SNAPSHOT)
|-- api-module (4.0.0)
|-- impl-module (6.0.0-SNAPSHOT)
|-- another-parent-module (2.0.0-SNAPSHOT)
|--|--sub-module1 (2.0.0)
|--|--sub-module2 (3.0.0)

I know about Maven Release Plugin and about Versions Maven Plugin but I can't figure out how to make them bump major version automatically.

Could you help me with this problem?

2
Fist it looks you are misusing multi module build cause usually all modules/parent should have the same version. Apart from that you can change the version by using mvn versions:set -DnewVersion=13.5.6.khmarbaise

2 Answers

1
votes

In a multi module project, every module should have the same version. I recommend to split your module in separate Maven projects and then it is easier to use the Maven Release Plugin and Versions Maven Plugin.

0
votes

I agree with the idea that

multi module project, every module should have the same version

but we already have some module structure in a big project where several teams are participating, and it could not be changed easily.

Since I have not found a solution I created a groovy script for this purpose: https://github.com/ddska/maven-semver-bumper