How to find out why a jar was included by Maven?
It looks like the pattern passed to -Dincludes
is incorrect.
From the documentation of Maven Dependency Plugin, the syntax of -Dincludes
is defined by StrictPatternIncludesArtifactFilter
. From the javadoc of AbstractStrictPatternArtifactFilter from which this is subclassed,
The artifact pattern syntax is of the form:
[groupId]:[artifactId]:[type]:[version]
Where each pattern segment is optional and supports full and partial * wildcards. An empty pattern segment is treated as an implicit wildcard.
For example,
org.apache.*
would match all artifacts whose group id started withorg.apache.
, and:::*-SNAPSHOT
would match all snapshot artifacts.
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
.
The format you are searching for is wrong. Try this:
mvn dependency:tree -Dverbose -Dincludes=:spring*::
(Searches for any artifact with a groupId that starts with spring)
Or this:
mvn dependency:tree -Dverbose -Dincludes=org.springframework
(Searches for any artifact with artifactId org.springframework)
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/