0

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?

dds
  • 2,335
  • 1
  • 31
  • 45
  • 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 Sep 24 '15 at 12:13

2 Answers2

1

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.

Sandra Parsick
  • 704
  • 7
  • 14
  • 2
    > In a multi module project, every module should have the same version. why is that? any proof link? – dds Sep 25 '15 at 05:38
  • In short, the idea behind is that when your application is large, then you split it in modules. So your modules should have the same version like your application to recognize which modules forms a special version of your application . You can find a good introduction to this topic in the book _[Maven By Example](http://books.sonatype.com/mvnex-book/reference/multimodule.html)_ – Sandra Parsick Sep 25 '15 at 09:34
  • 1
    You can also have multiple, independent applications within a single multi-module project – Marian Klühspies Jan 04 '22 at 19:08
0

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

dds
  • 2,335
  • 1
  • 31
  • 45