This is about Maven POM's
If I wanted the version of my parent to also be the version of my dependencies, I must set the value of the property to $ {project.parent.version}.
The problem arises when the child of my main POM (which has the property $ {project.parent.version} inside it, because it is the parent, is some kind of project that I do not administer), recount the property and think that the value of the created Properties is now a version of my main POM.
--SuperParent (not in my Administration) | Version = 1.2.3 ----MainPom | Version = 1.0.0 | Property <test>${project.parent.version}</test> -> 1.2.3 ------Child Pom | Version 1.0.0 | Property ${test} is now 1.0.0
<project> <groupId>groupId</groupId> <artifactId>artifactId</artifactId> <version>1.2.3</version> </project> <project> <groupId>othergroupId</groupId> <artifactId>otherartifactId</artifactId> <version>1.0.0</version> <parent> <groupId>groupId</groupId> <artifactId>artifactId</artifactId> <version>1.2.3</version> </parent> <properties> <dependency.version>${project.parent.version}</dependency.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>dependencyGroupId<groupId> <artifactId>dependency</artifactId> <version>${dependency.version}</version> </dependency> </dependencies> </dependencyManagement> </project> <project> <groupId>childGroupId</groupId> <artifactId>childArtifactId</artifactId> <version>1.0.0</version> <parent> <groupId>othergroupId</groupId> <artifactId>otherartifactId</artifactId> <version>1.0.0</version> </parent> <dependencies> <dependency> <groupId>dependencyGroupId<groupId> <artifactId>dependency</artifactId> </dependency> </dependencies> </project>
At the end, the $ {dependency.version} property is used in Child Pom 1.0.0 instead of 1.2.3. Is this a desirable Maven behavior? And what could I do to make it work?
Things that cannot be changed:
- Superpom
- The main version of Pom
source share