Java 在 Maven 2 中,我怎么知道哪个依赖项是传递依赖项?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34144/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
In Maven 2, how do I know from which dependency comes a transitive dependency?
提问by paulgreg
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 中的哪个依赖项带来了它。
采纳答案by A. Rex
To add to @David Crow, here's a dependency:tree examplefrom 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
回答by David Crow
回答by Valters Vingolds
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,它将打印出大量诊断信息,我想可以从那里获取相关的依赖路径。
回答by Filip Korling
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.
如果您已使用 maven 为项目生成站点,则依赖项信息也包含在项目信息/依赖项报告中。
回答by Brian Fox
If you use eclipse and the m2eclipse pluginthen there is a graphical version of dependency tree where you can filter by scope etc.
如果您使用 eclipse 和m2eclipse 插件,那么有一个图形版本的依赖树,您可以在其中按范围等进行过滤。
回答by Bang
You can have many reports by
您可以通过以下方式获得许多报告
mvn site
网站
One of them is the dependency report.
其中之一是依赖报告。