There is a dep library one of the modules (module1) of my project depends on. The dependency is declared in a parent's dependencyManagement section.
...
<groupId>group1</groupId>
<artifactId>parent-proj</artifactId>
...
<dependencyManagement>
<dependencies>
<dependency>
<groupId>group2</groupId>
<artifactId>dep</artifactId>
<version>1</version>
</dependency>
</dependencies>
</dependencyManagement>
...
...
<parent>
<groupId>group1</groupId>
<artifactId>parent-proj</artifactId>
...
</parent>
<artifactId>module1</artifactId>
...
<dependencies>
<dependency>
<groupId>group2</groupId>
<artifactId>dep</artifactId>
</dependency>
</dependencies>
...
dep in turn depends on subdep which I want to use as a dependency in another module (module2) inheriting from the same parent-proj. The point is to make module2 use the same version of subdep dep depends on without explicit declaration of the version in my project. However, when I try to add a dependency on subdep into module2 Maven doesn't realize what version of subdep has to be used:
...
<parent>
<groupId>group1</groupId>
<artifactId>parent-proj</artifactId>
...
</parent>
<artifactId>module2</artifactId>
...
<dependencies>
<dependency>
<groupId>group2</groupId>
<artifactId>subdep</artifactId>
</dependency>
</dependencies>
...
module2$ mvn dependency:tree
...
[ERROR] 'dependencies.dependency.version' for group2:subdep:jar is missing
...
Is there a way to use in a child project a transitive dependency implicitly managed in a parent project?