Maven Multi Module Versioning
Recently I have been working on a Maven multi module project with ear, war and ejb artifacts. It has been a pleasant experience till I got to versioning my modules. Consider a multi module project with the following structure:
parent-project
|
|- child-moudle
| |
| |–pom.xml
|
|- pom.xml
The parent project pom.xml holds the version information of the parent project:
com.inflinx project-parent 1.0.0-SNAPSHOT pom
Now the child module pom contains a reference to the parent information:
com.inflinx project-parent 1.0.0-SNAPSHOT 4.0.0 com.inflinx child-module jar
Now this is where the problem starts. Since all the child modules need to have an explicit reference to the parent pom version, when it is time to do a release, we have to change the version in parent pom and all the child module poms. This can be a real pain and is very error prone. With a little help from Google, here is what I found:
- Ceki on his blog suggested using a property in the parent pom to control the version numbering.
- Several maven users would like “automatic parent versioning” according this improvement
- Use maven release plugin which would automate the process of changing version numbers across the project
Option three seems to be the correct approach to solve this problem here. But I have heard horrible things about the release plugin and how fragile it is. I will be giving it a try soon. I still think that Maven should support automatic parent versioning as an option for users who don’t (or cannot) get to use the release plugin.