user2395365
user2395365

Reputation: 2149

How can I tell which maven dependency is responsible for including jars included in my WAR file?

I run mvn dependency:list

and then I get:

[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

How can I determine which dependency is responsible for Spring 3 jars as I only want the version 4 jars to be there.

Thanks!

Upvotes: 0

Views: 342

Answers (1)

Dror Bereznitsky
Dror Bereznitsky

Reputation: 20376

Running dependency:tree instead of dependency:list will show you the dependency tree for the project, which should reveal the origin of the Spring 3 dependencies.

Here is an example of how the dependency tree output looks like:

[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

Upvotes: 2

Related Questions