In Maven 2, how do I know from which dependency co

2019-01-29 22:27发布

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.

6条回答
孤傲高冷的网名
2楼-- · 2019-01-29 22:59

You can have many reports by

mvn site

One of them is the dependency report.

查看更多
Animai°情兽
3楼-- · 2019-01-29 23:05

If you use eclipse and the m2eclipse plugin (http://m2eclipse.sonatype.org) then there is a graphical version of dependency tree where you can filter by scope etc.

查看更多
闹够了就滚
4楼-- · 2019-01-29 23:13

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
查看更多
来,给爷笑一个
5楼-- · 2019-01-29 23:13

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.

查看更多
霸刀☆藐视天下
6楼-- · 2019-01-29 23:16

Using the Maven Dependency Plugin:

mvn dependency:tree
查看更多
smile是对你的礼貌
7楼-- · 2019-01-29 23:16

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.

查看更多
登录 后发表回答