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.
In Maven, you declare your project's dependencies in your pom. xml file. Once you've added the dependency into your POM, Maven does the rest. At build time, it downloads the dependency, and makes it available to the build process.
jar file. Use the -verbose:class option to find class-level dependencies or use the -v or -verbose option to include dependencies from the same JAR file.
In your project's target directory you'll see the generated jar file which is named like: 'core-1.0-SNAPSHOT. jar'. The resulting 'jar' file contains the compiled java class files as well as the files from src/main/resources.
A project's dependency tree can be filtered to locate specific dependencies. For example, to find out why Velocity is being used by the Maven Dependency Plugin, we can execute the following in the project's directory: mvn dependency:tree -Dincludes=velocity:velocity.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With