I have a Maven parent-child structure.
Parent pom has a dependency defined like this in the dependencyManagment section:
<dependencyManagement>
...
<dependency>
<groupId>myGroupId</groupId>
<artifactId>dependency</artifactId>
<version>${project.version}</version>
</dependency>
...
</dependencyManagement>
Child pom uses that dependency:
<dependency>
<groupId>myGroupId</groupId>
<artifactId>dependency</artifactId>
</dependency>
The version is resolved to ${project.version} which in turn is resolved to child project version.
In my case, child has different versioning cycle to its parent. The problem is that I want the dependency included to have parent project version instead of child version. I can't assume hierachy is only one level so I can't use ${parent.version}. I want the version resolved to match the version of the pom in which it is defined.
How can I do that?
Thanks.