Reputation: 3502
I need to exclude an artifact where I know the group ID, artifact ID and version of what I want to exclude but how can I find out what dependencies in my pom have this particular artifact as a dependency. I'm using maven 2x, don’t see a way for global exclusions. Does anyone know how I can find out what the offending dependencies are without having to look at each one?
I've looked around and can't find any answers.
Upvotes: 1
Views: 3119
Reputation: 122414
dependency:tree
can help you here. From the Maven dependency plugin documentation:
mvn dependency:tree -Dverbose -Dincludes=commons-collections
will tell you what is pulling in commons-collections
:
[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: 7