Question

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.

Was it helpful?

Solution

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 with org.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.

OTHER TIPS

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/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top