IntroductionTrying to build maven from a single svn commit (actually it was a TAG commit), I found that it is impossible without a central repository or information from other svn commits. I present details about this case of "cross commit version cycle". I call this a "inconsistency" on Maven Model because it allows to create commit versions of a project that are not self-sufficient.
Any inconsistency about this inconsistency is welcome.
Maven project model (fragment)In maven there are two different project relations Parent Relation and Module Relation.
Parent Relation inherent project properties and Module Relation manage the build process: "When building this project, build also this submodules".Look at the maven reference documentation for full reference: http://www.sonatype.com/books/mvnref-book/reference/pom-relationships-sect-project-relationships.html
Snapshot versions and release versionsMost Maven projects have a main parent and many submodules as on figure 1.
|Figure 1. Project structure and relations|
Snapshot versions are used during development, to get the last version of the source code. Maven look on the central (or project if configured) repository to look for the last build.
When a release is ready, all the projects may be commited with version 1.0. You get then a concrete release and relations as on figure 2.
|Figure 2. Release commit with version 1.0|
Problem on partial version upgradeThe problem with Parent/Module relations appears on partial increase of versions. Assume that only some submodules versions are increased on release 1.1 (fig 3). As parent project has old version 1.0 (it was not changed) then submodules 1.1 refere to version 1.0. Lets call this commit 1.1_partial.
|Figure 3. 1.1_partial commit|
Now, increase on a new commit 1.1_rest the version of remaining projects to 1.1. You get a commit where each pom has version 1.1, BUT!! submodules changed on commit 1.1_partial have as parent pom with version 1.0 (fig. 4)
|Figure4. Inconsistency relations cross commits|
It may look as a bad use of maven versioning, but the model allows this situations so: how to interpret such a 1.1_rest commit??
Some simple argumentsTalking about this "inconsistency" on maven model, I get the follow counterarguments:
This don't happen!I found this trying to build maven from source from a tag commit, so here is the example:
- PARENT: org.apache.maven.plugins:maven-plugins:pom
- SUBMODULE: maven-clean-plugin:maven-plugin
PARENT(18) --submodule--> SUBMODULE(2.5-SNAPSHOT) --parent--> PARENT(17)Look here to see this relations:
- PARENT(18) pom: http://svn.apache.org/viewvc/maven/plugins/tags/maven-plugins-18/pom.xml?view=co&revision=940021&content-type=text%2Fplain
- SUBMODULE(2.5-SNAPSHOT) pom :http://svn.apache.org/viewvc/maven/plugins/tags/maven-plugins-18/maven-clean-plugin/pom.xml?view=co&revision=940021&content-type=text%2Fplain