如何判断哪个maven依赖项负责包含我的WAR文件中包含的jar?

时间:2014-04-08 18:41:19

标签: java spring maven

我运行mvn依赖:list

然后我得到:

[INFO] The following files have been resolved:
....
[INFO]    org.springframework:spring-aop:jar:3.2.8.RELEASE:compile
[INFO]    org.springframework:spring-beans:jar:3.2.8.RELEASE:compile
[INFO]    org.springframework:spring-context:jar:3.2.8.RELEASE:compile
[INFO]    org.springframework:spring-core:jar:4.0.3.RELEASE:compile
[INFO]    org.springframework:spring-expression:jar:3.2.8.RELEASE:compile
[INFO]    org.springframework:spring-jdbc:jar:3.2.8.RELEASE:compile
[INFO]    org.springframework:spring-orm:jar:3.2.8.RELEASE:compile
[INFO]    org.springframework:spring-oxm:jar:4.0.3.RELEASE:compile
[INFO]    org.springframework:spring-test:jar:4.0.3.RELEASE:compile
[INFO]    org.springframework:spring-tx:jar:3.2.8.RELEASE:compile
[INFO]    org.springframework:spring-web:jar:4.0.3.RELEASE:compile
[INFO]    org.springframework.data:spring-data-commons:jar:1.7.1.RELEASE:compile
[INFO]    org.springframework.data:spring-data-jpa:jar:1.5.1.RELEASE:compile

我如何确定哪个依赖项负责Spring 3 jar,因为我只希望版本4 jars在那里。

谢谢!

1 个答案:

答案 0 :(得分:2)

运行dependency:tree而不是依赖:list将显示项目的依赖关系树,它应该显示Spring 3依赖关系的来源。

以下是依赖关系树输出的示例:

[INFO] [dependency:tree]
[INFO] org.apache.maven.plugins:maven-dependency-plugin:maven-plugin:2.0-alpha-5-SNAPSHOT
[INFO] +- org.apache.maven.reporting:maven-reporting-impl:jar:2.0.4:compile
[INFO] |  \- commons-validator:commons-validator:jar:1.2.0:compile
[INFO] |     \- commons-digester:commons-digester:jar:1.6:compile
[INFO] |        \- (commons-collections:commons-collections:jar:2.1:compile - omitted for conflict with 2.0)
[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]       \- commons-collections:commons-collections:jar:2.0:compile