0

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.

narduk
  • 964
  • 1
  • 9
  • 19
  • 2
    If your child has different versions you should not use multi module build cause that's the basic idea of it. – khmarbaise Mar 23 '15 at 15:44
  • Sometimes it is useful to have a different release cycle for parent and child. http://stackoverflow.com/questions/1992213/maven-parent-pom-vs-modules-pom – narduk Mar 23 '15 at 15:57
  • This is similar but for the answer, he does not need different life cycles. http://stackoverflow.com/questions/16895555/maven-managed-dependencies-resolving-project-version-from-parent-pom – narduk Mar 23 '15 at 18:44

0 Answers0