如何找出 Maven 包含某个 jar 的原因?
我们将 Maven 3 与 IntelliJ 用于我们的 IDE。编译后,我们得到了一堆 spring 2.0 的东西,它们被包含在外部库中。如果我查看 Intellij 中的 Maven 项目依赖项,我没有看到任何人依赖于 spring 2.0,所以我怀疑这是我们所依赖的东西,而它又依赖于它。
我的问题是我将如何追踪这一点?我尝试执行 mvn dependency:tree -Dverbose -Dincludes=spring-aop
甚至 -Dincludes=spring
但从根或子模块目录运行时没有得到任何结果我知道正在使用弹簧。
We're using Maven 3 with IntelliJ for our IDE. After a compile we get a bunch of spring 2.0 stuff being included in the External Libraries. If I look through Maven Projects dependencies in Intellij I don't see anyone with a dependency on spring 2.0 so I suspect it's something we're depending on which depends on it.
My question is how would I track this down? I tried doing a mvn dependency:tree -Dverbose -Dincludes=spring-aop
and even -Dincludes=spring
but get no results when ran from the root or a sub module directory that I know is using spring.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看起来传递给
-Dincludes
的模式不正确。从 Maven 依赖插件 的文档中,
-Dincludes
的语法由StrictPatternIncludesArtifactFilter
定义。来自AbstractStrictPatternArtifactFilter 这是它的子类,也许您应该运行不带
-Dincludes
的mvn dependency:tree
并查看它是否显示 spring 2.0 相关依赖项。或者,为-Dincludes
指定适当的模式。It looks like the pattern passed to
-Dincludes
is incorrect.From the documentation of Maven Dependency Plugin, the syntax of
-Dincludes
is defined byStrictPatternIncludesArtifactFilter
. From the javadoc of AbstractStrictPatternArtifactFilter from which this is subclassed,Maybe you should run
mvn dependency:tree
without-Dincludes
and see if it shows up the spring 2.0 related dependency. Alternately, specify the appropriate pattern for-Dincludes
.您搜索的格式错误。试试这个:(
搜索任何带有以 spring 开头的 groupId 的工件)
或者这个:(
搜索带有 artifactId org.springframework 的任何工件)
The format you are searching for is wrong. Try this:
(Searches for any artifact with a groupId that starts with spring)
Or this:
(Searches for any artifact with artifactId org.springframework)
为什么不使用 intellij 并轻松修复它。
打开 pom.xml,右键单击(调用上下文菜单)并选择 UML >显示依赖关系(假设您启用了 UML 插件)。
Idea 将标记所有重复的依赖项,您可以使用 ALT+Enter 组合来排除依赖项。
@参见:
http://blogs.jetbrains.com/idea/2010/05/ maven-依赖关系图/
Why not use intellij and easy fix it.
Open your pom.xml, right-click (invoke context menu) and choose UML > show dependencies (assumin you have UML plugin enabled).
Idea will mark all duplicate dependency and you can use ALT+Enter combo to exclude dependencies.
@see also:
http://blogs.jetbrains.com/idea/2010/05/maven-dependencies-diagram/