Reputation: 576
I thought dependencyManagement from parents were transitive aren't they? Never see that explicitely in the doc, but it seemed obvious to me...
Here's what i have:
+-----------------------+
| Parent 1 |
|-----------------------|
| dependencyManagement: |
| lib1: 1.0.0 |
+-----------------------+
^
|
|
+-----------+-----------+
| Parent 2 |
|-----------------------|
| dependencyManagement: |
| lib2: 1.0.0 |
+-----------------------+
^
|
+-----------+-----------+
| Project A |
|-----------------------|
| dependencies: |
| lib1 |
| lib2 |
+-----------------------+
When i try to mvn install Project A, i get:
[ERROR] 'dependencies.dependency.version' for lib1-digester:jar is missing. @ line XX, column YY
I also tried to add an entry of Parent 1 in the dependencyManagement of Parent 2 with the import scope, with no success..
How can my Project A have versions managed by all it's parent hierarchy?
Upvotes: 4
Views: 945
Reputation: 576
A made a small example with other empty projects, and everything went fine... Finally, there was something strange, here's what happened. I was actually more like that:
+-----------------------+
| Parent 1 |
|-----------------------|
| dependencyManagement: |<----------------------+
| lib1: 1.0.0 | |
+-----------------------+ |
^ |
| +-------------+------------+
| | Project B |
+-----------+-----------+ |--------------------------|
| Parent 2 | | dependencies: |
|-----------------------| | somethingWrong: 1.0.0 |
| dependencyManagement: | +--------------------------+
| lib2: 1.0.0 |
+-----------------------+
^
|
+-----------+-----------+
| Project A |
|-----------------------|
| dependencies: |
| lib1 |
| lib2 |
+-----------------------+
There was an error in Project B's pom.xml It shouldn't have any impact on my problem, but correcting that unrelated pom solved my problem...
Sorry for the wasted time
Upvotes: 2
Reputation: 328724
Try to update to the latest version of Maven 3. IIRC, there were a couple of bugs in the inheritance of dependencyManagement
elements.
Upvotes: 2
Reputation: 2198
It seems you are correct after reading the Maven Docs.
In general, all dependencies of those projects are used in your project, as are any that the project inherits from its parents, or from its dependencies, and so on.
Upvotes: 2