Java 我如何读取 Maven 依赖树
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20189350/
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
How do I read a Maven dependency tree
提问by user2982680
I have servlet-api version 2.5 as provided scope in pom.xml. Here is part of the dependency:tree output of my project. What does "version managed from 2.3; scope managed from compile" mean?
我有 servlet-api 版本 2.5 作为 pom.xml 中提供的范围。这是我项目的依赖项:树输出的一部分。“从 2.3 管理的版本;从编译管理的范围”是什么意思?
[INFO] +- commons-logging:commons-logging:jar:1.1:compile
[INFO] | \- javax.servlet:servlet-api:jar:2.5:provided (version managed from 2.3; scope managed from compile)
Does that mean there is some transitive dependency on version 2.3 on my classpath? My WARfile does not have servlet-api jar at all, but I do use old version of Spring2.5.4. I suspect the Spring framework depends on servlet-api 2.3.
这是否意味着在我的类路径上对 2.3 版存在一些传递依赖?我的WAR文件根本没有 servlet-api jar,但我确实使用旧版本的Spring2.5.4。我怀疑 Spring 框架依赖于 servlet-api 2.3。
采纳答案by DB5
The message basically means that the version
of servlet-api would have transitively been 2.3 (so basically in commons-logging's pom they define servlet-api with version 2.3), but that version 2.5 was specifically asked for in your project, so that is what was used.
该消息基本上意味着version
servlet-api 将传递为 2.3(所以基本上在 commons-logging 的 pom 中,他们定义了 servlet-api 版本为 2.3),但是在您的项目中特别要求使用 2.5 版本,所以这就是用过的。
Same goes for the scope. In commons-logging's pom it is defined with scope compile
, but you have it defined with scope provided
, so again that is the scope that was used.
范围也是如此。在 commons-logging 的 pom 中,它是用 scope 定义的compile
,但是你用 scope 定义了它provided
,所以这也是使用的作用域。
回答by lichengwu
It means that your project has overridden the version
and scope
from other dependencies.
这意味着您的项目已经覆盖了其他依赖项中的version
和scope
。