In the situation I outlined the transitive dependency should truly be
transitive, not direct.  However the transitive dependency is picked up
twice yet omitted because the first artifact where it is detected is
eventually omitted.  The fact that I can change the dependency order in
artifact A and get a different list of resolved artifacts leads me to
believe this is more likely to be a defect but I wanted to be sure I
understood the dependency resolution algorithm correctly first.  

dependency:analyze would flag artifact D as unused.  My understanding is the
the dependency to artifact E via artifact B should bring resolution to
artifact D.


Anders Hammar wrote:
> 
> I don't understand. Are you saying you have a dependency on a transitive
> dependency? That's wrong! You should declare all your dependencies as
> dependencies; you shouldn't rely on transitive dependencies.
> 
> Try
> mvn dependency:analyze
> and fix missing dependencies!
> 
> /Anders
> 
> On Wed, Dec 16, 2009 at 22:14, egroesbeck <dre...@yahoo.com> wrote:
> 
>>
>> 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
>>
>>
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Transitive-dependency-omitted-if-prior-dependency-resolved-first-then-subsquently-omitted-tp26818594p26829143.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