What is the best practice for versioning and release management in the following case with multiprojects?
Project structure
- global parent
- parent project (Version: 1.0-SNAPSHOT)
- child project 1 (same like parent)
- child project 2 (same like parent)
- child project 3 (same like parent)
- child project 4 (same like parent)
- …
- parent project (Version: 1.0-SNAPSHOT)
I want to set only one time the version for the parent and all child projects, because every part of the project must have the same version.
Also what i want is, to release the project with continuum/maven.
Current "bad" solution:
Normaly a easy way should be to set the version in the parent pom and say in every child „last version from parent“ but this dont work with maven <3.1 (See here)[http://jira.codehaus.org/browse/MNG-624] Now i set in every child project the version of the parent project and for every release i must change the version in all childs and the parent.
Example:
Parent
<groupId>com.test</groupId>
<artifactId>com.test.buildDefinition</artifactId>
<version>1.0-SNAPSHOT</version>
Child
<parent>
<groupId>com.test</groupId>
<artifactId>com.test.buildDefinition</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.test</groupId>
<artifactId>com.test.project</artifactId>
<version>${parent.version}</version>
If i want to release my projects now with Continuum i use the following order to release it:
- Parent Project
- Child Project 1
- Child Project 2
- …
But this dont work, because after changeing the version of the parent, the childs dont have anymore a SNAPSHOT version in the parent and i think there must be a better way to release a multiproject with continuum.
If you add your child modules in the
<dependencyManagement/>
tag I am quite sure that you will not have that problem.Parent
Child1
Child2 (depends on Child1)
If you try to when using the dependencyManagement the dependencies between modules will never have to define any versions since they are defined in the parents pom.
I have never had any problems with releasing multi-module projects by this approach.
Edit
To be clear:
dependencyManagement
does not have anything to do with the inheritence between parent-child. It solves any problems with the version of dependencies between child modules. And it works during releases.