在Maven 2中,我如何知道依赖性来自哪个依赖?

时间:2021-02-10 07:12:16

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

我想知道我的pom.xml中描述的哪个依赖项在我的目标目录中带来了传递依赖。

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.

更确切地说,我的WEB-INF / lib目录中有库“poi-2.5.1-final-20040804.jar”,我想知道我的pom.xml中的哪个依赖项带来了这个。

6 个解决方案

#1


111  

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

要添加到@David Crow,这里是一个依赖:来自Maven站点的树示例:

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

#2


39  

Using the Maven Dependency Plugin:

使用Maven依赖插件:

mvn dependency:tree

#3


7  

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.

如果你使用eclipse和m2eclipse插件(http://m2eclipse.sonatype.org),那么有一个依赖树的图形版本,你可以按范围等过滤。

#4


2  

You can have many reports by

你可以有很多报告

mvn site

mvn网站

One of them is the dependency report.

其中之一是依赖性报告。

#5


1  

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.

如果您使用“-x”开关运行maven,它将打印出大量的诊断信息,我猜相关的依赖路径可以从那里获取。

#6


1  

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.

如果您使用mvn站点为maven生成项目的站点,则依赖项信息也包含在“项目信息/依赖项”报告中。

#1


111  

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

要添加到@David Crow,这里是一个依赖:来自Maven站点的树示例:

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

#2


39  

Using the Maven Dependency Plugin:

使用Maven依赖插件:

mvn dependency:tree

#3


7  

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.

如果你使用eclipse和m2eclipse插件(http://m2eclipse.sonatype.org),那么有一个依赖树的图形版本,你可以按范围等过滤。

#4


2  

You can have many reports by

你可以有很多报告

mvn site

mvn网站

One of them is the dependency report.

其中之一是依赖性报告。

#5


1  

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.

如果您使用“-x”开关运行maven,它将打印出大量的诊断信息,我猜相关的依赖路径可以从那里获取。

#6


1  

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.

如果您使用mvn站点为maven生成项目的站点,则依赖项信息也包含在“项目信息/依赖项”报告中。