In Maven 2, how do I know from which dependency comes a transitive dependency?

JavaMaven 2Build Process

Java Problem Overview


I would like to know which dependency described in my pom.xml brings a transitive dependency in my target directory.

To be more precise, I have the library "poi-2.5.1-final-20040804.jar" in my WEB-INF/lib directory and I would like to know which dependency in my pom.xml brings that.

Java Solutions


Solution 1 - Java

To add to @David Crow, here's a dependency:tree example from the Maven site:

mvn dependency:tree -Dincludes=velocity:velocity

might output

[INFO] [dependency:tree]
[INFO] org.apache.maven.plugins:maven-dependency-plugin:maven-plugin:2.0-alpha-5-SNAPSHOT
[INFO] \- org.apache.maven.doxia:doxia-site-renderer:jar:1.0-alpha-8:compile
[INFO]    \- org.codehaus.plexus:plexus-velocity:jar:1.1.3:compile
[INFO]       \- velocity:velocity:jar:1.4:compile

Solution 2 - Java

Using the Maven Dependency Plugin:

mvn dependency:tree

Solution 3 - Java

If you use eclipse and the m2eclipse plugin then there is a graphical version of dependency tree where you can filter by scope etc.

Solution 4 - Java

If you run maven with "-x" switch, it will print out plenty of diagnostics, I guess the relevant dependency path can be picked up from there.

Solution 5 - Java

You can have many reports by

> mvn site

One of them is the dependency report.

Solution 6 - Java

The dependency information is also included in the Project Information/Dependencies report if you have maven generate a site for the project, using mvn site.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionpaulgregView Question on Stackoverflow
Solution 1 - JavaA. RexView Answer on Stackoverflow
Solution 2 - JavaDavid CrowView Answer on Stackoverflow
Solution 3 - JavaBrian FoxView Answer on Stackoverflow
Solution 4 - JavaValters VingoldsView Answer on Stackoverflow
Solution 5 - JavaBangView Answer on Stackoverflow
Solution 6 - JavaFilip KorlingView Answer on Stackoverflow