Problem: a transitive dependency is found in a graph multiple times but the
first artifact that depends on it is omitted for a higher version which no
longer has the transitive dependency.  This causes the final artifact list
to no longer include the transitive dependency even it other dependencies
depend on it.

I've included the graph and results of dependency:tree as reference. 
Changing the dependency order in project A to depend on E then C resolves
the issue as well as managing C to 2.0.0 (the version that eventually is
resolved).  However as the graph grows larger this becomes burdensome.  I
didn't find this situation described in the dependency mechanism
documentation and managing all the dependencies to match the declared
versions felt like overkill.  Is this behavior correct?

Tested with Maven versions: 2.0.10, 2.2.1, 3.0-alpha-5

Dependency graph:
A->B->C-1.0.0-SNAPSHOT->D
A->C-2.0.0-SNAPSHOT
B->E->D

Result of dependency:tree -Dverbose:
[INFO] test.projects:projectA:jar:2.0.0-SNAPSHOT
[INFO] +- test.projects:projectB:jar:1.0.0-SNAPSHOT:compile
[INFO] |  +- (test.projects:projectC:jar:1.0.0-SNAPSHOT:compile - omitted
for conflict with 2.0.0-SNAPSHOT)
[INFO] |  \- test.projects:projectE:jar:1.0.0-SNAPSHOT:compile
[INFO] |     \- (test.projects:projectD:jar:1.0.0-SNAPSHOT:compile - omitted
for duplicate)
[INFO] \- test.projects:projectC:jar:2.0.0-SNAPSHOT:compile

Result of dependency:tree -Dverbose -X:
[INFO] [dependency:tree {execution: default-cli}]
[DEBUG] Dependency tree resolution listener events:
[DEBUG] testArtifact: artifact=test.projects:projectA:jar:2.0.0-SNAPSHOT
[DEBUG] includeArtifact: artifact=test.projects:projectA:jar:2.0.0-SNAPSHOT
[DEBUG] startProcessChildren:
artifact=test.projects:projectA:jar:2.0.0-SNAPSHOT
[DEBUG]   testArtifact:
artifact=test.projects:projectB:jar:1.0.0-SNAPSHOT:compile
[DEBUG]   includeArtifact:
artifact=test.projects:projectB:jar:1.0.0-SNAPSHOT:compile
[DEBUG]   startProcessChildren:
artifact=test.projects:projectB:jar:1.0.0-SNAPSHOT:compile
[DEBUG]     testArtifact:
artifact=test.projects:projectC:jar:1.0.0-SNAPSHOT:compile
[DEBUG]     includeArtifact:
artifact=test.projects:projectC:jar:1.0.0-SNAPSHOT:compile
[DEBUG]     startProcessChildren:
artifact=test.projects:projectC:jar:1.0.0-SNAPSHOT:compile
[DEBUG]       testArtifact:
artifact=test.projects:projectD:jar:1.0.0-SNAPSHOT:compile
[DEBUG]       includeArtifact:
artifact=test.projects:projectD:jar:1.0.0-SNAPSHOT:compile
[DEBUG]       startProcessChildren:
artifact=test.projects:projectD:jar:1.0.0-SNAPSHOT:compile
[DEBUG]       endProcessChildren:
artifact=test.projects:projectD:jar:1.0.0-SNAPSHOT:compile
[DEBUG]     endProcessChildren:
artifact=test.projects:projectC:jar:1.0.0-SNAPSHOT:compile
[DEBUG]     testArtifact:
artifact=test.projects:projectE:jar:1.0.0-SNAPSHOT:compile
[DEBUG]     includeArtifact:
artifact=test.projects:projectE:jar:1.0.0-SNAPSHOT:compile
[DEBUG]     startProcessChildren:
artifact=test.projects:projectE:jar:1.0.0-SNAPSHOT:compile
[DEBUG]       testArtifact:
artifact=test.projects:projectD:jar:1.0.0-SNAPSHOT:compile
[DEBUG]       omitForNearer:
omitted=test.projects:projectD:jar:1.0.0-SNAPSHOT:compile
kept=test.projects:projectD:jar:1
.0.0-SNAPSHOT:compile
[DEBUG]     endProcessChildren:
artifact=test.projects:projectE:jar:1.0.0-SNAPSHOT:compile
[DEBUG]   endProcessChildren:
artifact=test.projects:projectB:jar:1.0.0-SNAPSHOT:compile
[DEBUG]   testArtifact:
artifact=test.projects:projectC:jar:2.0.0-SNAPSHOT:compile
[DEBUG]   omitForNearer:
omitted=test.projects:projectC:jar:1.0.0-SNAPSHOT:compile
kept=test.projects:projectC:jar:2.0.0
-SNAPSHOT:compile
[DEBUG]   includeArtifact:
artifact=test.projects:projectC:jar:2.0.0-SNAPSHOT:compile
[DEBUG]   startProcessChildren:
artifact=test.projects:projectC:jar:2.0.0-SNAPSHOT:compile
[DEBUG]   endProcessChildren:
artifact=test.projects:projectC:jar:2.0.0-SNAPSHOT:compile
[DEBUG] endProcessChildren:
artifact=test.projects:projectA:jar:2.0.0-SNAPSHOT
[INFO] test.projects:projectA:jar:2.0.0-SNAPSHOT
[INFO] +- test.projects:projectB:jar:1.0.0-SNAPSHOT:compile
[INFO] |  +- (test.projects:projectC:jar:1.0.0-SNAPSHOT:compile - omitted
for conflict with 2.0.0-SNAPSHOT)
[INFO] |  \- test.projects:projectE:jar:1.0.0-SNAPSHOT:compile
[INFO] |     \- (test.projects:projectD:jar:1.0.0-SNAPSHOT:compile - omitted
for duplicate)
[INFO] \- test.projects:projectC:jar:2.0.0-SNAPSHOT:compile
-- 
View this message in context: 
http://old.nabble.com/Transitive-dependency-omitted-if-prior-dependency-resolved-first-then-subsquently-omitted-tp26818594p26818594.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to