How to dependency:tree on a specific artifact? - java

Title says it all. Given a dependency, how can I get a tree of its dependencies?
Let's say I want to target org.hibernate:hibernate-core:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.24.Final</version>
</dependency>
As a result I want:
[INFO] | \- org.hibernate:hibernate-core:jar:5.4.24.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.4.1.Final:compile
[INFO] | +- javax.persistence:javax.persistence-api:jar:2.2:compile
[INFO] | +- net.bytebuddy:byte-buddy:jar:1.10.17:compile
[INFO] | +- antlr:antlr:jar:2.7.7:compile
[INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.1.1.Final:compile
[INFO] | +- org.jboss:jandex:jar:2.1.3.Final:compile
[INFO] | +- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] | +- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] | +- org.dom4j:dom4j:jar:2.1.3:compile
[INFO] | \- org.hibernate.common:hibernate-commons-annotations:jar:5.1.2.Final:compile
I tried:
mvn dependency:tree -DgroupId=org.hibernate -DartifactId=hibernate-core -Dversion=5.4.24.Final
But It does not work.
:tree or :list does not matter. All I want is the dependencies of a dependency in my project.
If I mvn dependency:tree -Dincludes=org.hibernate:hibernate-core I get:
[INFO] \- org.hibernate:hibernate-core:jar:5.4.24.Final:compile
and its dependencies are missing.
There is this online "tool" that does exactly what I want. Is it possible to do it with a mvn command?

What you get is expected.
When using the includes user property such as : -Dincludes=org.hibernate:hibernate-core, the output shows the org.hibernate:hibernate-core dependency along the dependency(ies) that pulled that one.
You want the reverse : displaying the dependencies pulled by org.hibernate:hibernate-core.
To achieve that : you need to execute mvn dependency:tree since the org.hibernate:hibernate-core POM.
So You should go with your shell into your local repository and execute that command.
But that is an hassle : IDE Plugins for Maven provided by Eclipse and IntelliJ do that very well.
Example with m2e Eclipse plugin.
On the m2 view of your pom.xml, double click on the dependency that you want to develop.
And that is done :
A Maven way alternative if suitable would be using the dependency:copy goal by specifying pom as classifier :
#retrieve and store the hibernate pom
mvn dependency:copy -Dartifact=org.hibernate:hibernate-core:5.2.14.final:pom
#see the dependencty tree on the hibernate pom
mvn -f target/dependency/hibernate-core-5.2.14.final.pom dependency:tree
Two notes :
it will work even if the artifact is in your local repository (the artifact is first installed in that case).
you can specify the current directory as output directory instead of the default path that is target/dependency with the -DoutputDirectory=. flag.

Related

How do I know why a certain Jar was added to my project?

Is there a way to enter a single jar name to maven and get the full path of jars that added it to my project?
The best thing that you can do is using the mvn dependency:tree command.
It doesn't display the full path of jars that pulled the dependencies.
Instead, it displays the dependency tree for the current Maven project.
You could so know for each resolved dependency the Maven module/dependency that pulled that.
Make the mapping between a dependency identified by the trio groupId-artifactId-version and your local repository should be so very simple.
Here is an example with a project that among other things has jmh as dependency :
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # map-benchmark ---
[INFO] davidxxx:map-benchmark:jar:1.0
[INFO] +- junit:junit:jar:4.7:test
[INFO] +- org.openjdk.jmh:jmh-core:jar:1.19:compile
[INFO] | +- net.sf.jopt-simple:jopt-simple:jar:4.6:compile
[INFO] | \- org.apache.commons:commons-math3:jar:3.2:compile
[INFO] \- org.openjdk.jmh:jmh-generator-annprocess:jar:1.19:compile
You can see for example that junit is not a transitive dependency as it pulled by the current project itself.
But you could also see that commons-math3 is a transitive dependency pulled by jopt-simple itself pulled by jmh-core.
The dependency:tree goal can also be used to filter only specific dependencies.
mvn dependency:tree -Dincludes=org.apache.commons:commons-math3
or (note : without prefix if we don't need to specify the groupId) :
mvn dependency:tree -Dincludes=:commons-math3
will output :
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # map-benchmark ---
[INFO] davidxxx:map-benchmark:jar:1.0
[INFO] \- org.openjdk.jmh:jmh-core:jar:1.19:compile
[INFO] \- org.apache.commons:commons-math3:jar:3.2:compile
[INFO] ------------------------------------------------------------------------
This plugin can help to solve conflicts.
Here is a relevant example from the documentation.
For example, to find out why Commons Collections 2.0 is being used by
the Maven Dependency Plugin, we can execute the following in the
project's directory:
mvn dependency:tree -Dverbose -Dincludes=commons-collections
The verbose flag instructs the dependency tree to display conflicting
dependencies that were omitted from the resolved dependency tree. In
this case, the goal outputs:
[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
Check
https://maven.apache.org/plugins/maven-dependency-plugin/examples/filtering-the-dependency-tree.html
You can search for an specific artifact using this maven command:
mvn dependency:tree -Dincludes=DESIRED-groupId:DESIRED-artifactId
Also, if you use eclipse and the m2eclipse plugin (http://m2eclipse.sonatype.org) then there is a graphical version of dependency tree which will help you to filter it by jar name. See: https://books.sonatype.com/m2eclipse-book/reference/dependencies-sect-analyze-depend.html
There should be similar features in other IDEs

How to know which tomcat version embedded in spring boot

I used spring boot in project. It has inbuild tomcat server. I find out a jar spring-boot-starter-tomcat-1.2.5.RELEASE.jar. I required to do certain tomcat related configuration on linux server.
How can I get to know which tomcat version used in this?
You can also check the version without leaving your IDE by seeing the effective pom.
For example, if you are using IntelliJ you can view effective pom by right clicking pom.xml > Maven > Show effective POM.
...or from the command line by issuing mvn help:effective-pom
Via http://search.maven.org/, in https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-dependencies/1.2.5.RELEASE/spring-boot-dependencies-1.2.5.RELEASE.pom:
<tomcat.version>8.0.23</tomcat.version>
or For Gradle print the dependepency tree via the console with
./gradlew dependencies
Example snippet from output:
...
| +--- org.springframework.boot:spring-boot-starter-tomcat:2.1.0.RELEASE
| | +--- javax.annotation:javax.annotation-api:1.3.2
| | +--- org.apache.tomcat.embed:tomcat-embed-core:9.0.12
| | +--- org.apache.tomcat.embed:tomcat-embed-el:9.0.12
| | \--- org.apache.tomcat.embed:tomcat-embed-websocket:9.0.12
| | \--- org.apache.tomcat.embed:tomcat-embed-core:9.0.12
...
In my example above it is tomcat version 9.0.12
You can look at http://mvnrepository.com/:
http://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-tomcat/1.2.5.RELEASE
Below you have section Compile Dependencies and you can see that it uses Tomcat 8.0.23.
You can check the versions of all the dependencies in the dependency tree.
for that:
go to the directory of pom.xml
run the following command:
$ mvn dependency:tree
[INFO] Scanning for projects...
enter code here
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building {Project Name}
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # spring-mvc-logback ---
[INFO] com.sj.common:spring-mvc-logback:war:1.0-SNAPSHOT
[INFO] +- org.springframework:spring-core:jar:4.1.6.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:4.1.6.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:4.1.6.RELEASE:compile
[INFO] | +- org.springframework:spring-context:jar:4.1.6.RELEASE:compile
[INFO] | | \- org.springframework:spring-aop:jar:4.1.6.RELEASE:compile
[INFO] | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | +- org.springframework:spring-expression:jar:4.1.6.RELEASE:compile
[INFO] | \- org.springframework:spring-web:jar:4.1.6.RELEASE:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.12:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.12:compile
[INFO] +- ch.qos.logback:logback-classic:jar:1.1.3:compile
[INFO] | \- ch.qos.logback:logback-core:jar:1.1.3:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.937 s
[INFO] Finished at: 2015-06-19T19:17:54+08:00
[INFO] Final Memory: 13M/308M
[INFO] ------------------------------------------------------------------------
And you will be able to watch all the dependencies and versions associated with that dependency.
In Eclipse IDE:
Open your pom.xml
Go to "Effective POM" tab
Search for "tomcat"
Find <tomcat.version> line, for example: <tomcat.version>9.0.27</tomcat.version>
For those who use PCF i.e. cloudfoundry
I generally keep spring boot tomcat dependency as provided
Which means my local tomcat version may be slightly different.
The java buildpack includes the tomcat version
https://github.com/cloudfoundry/java-buildpack/releases
e.g. java buildpack 4.19.1 comes with Openjdk 1.8.0_212 and tomcat 9.0.19
Consider the below snippet of your project's pom.xml wherein default parent is spring-boot-starter-parent
Your project pom.xml
<!--Spring boot parent project -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.5</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
Next lookup pom.xml of spring-boot-starter-parent project to see the dependencies, it has the spring-boot-dependencies as its parent. If using modern IDEs like IntelliJ/Vscode can easily traverse within IDE.
spring-boot-starter-parent pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.4.5</version>
</parent>
One level up again i.e., to spring-boot-dependencies it further doesn't have a parent, under properties all the defaults are listed. Sample snippet below having non exhaustive list showing only tomcat.
spring-boot-dependencies pom.xml
<properties>
<!-- Other dependencies -->
<tomcat.version>9.0.45</tomcat.version>
<!-- Other dependencies -->
</properties>
This way, we can search for all the defaults out of the box.
Print the dependepency tree via the console with
mvn dependency:tree

Unable to load CoreNLP Shift-Reduce model into CoreNLP jar

I don't understand how to load CoreNLP's Shift-Reduce Constituency Parser (SRCP) from my java app.
I'm using Apache Maven to manage my project's dependencies. Per the docs, the SRCP model is not bundled with CoreNLP, so I have downloaded stanford-srparser-2014-10-23-models.jar separately (http://nlp.stanford.edu/software/srparser.shtml) and placed that file in:
~/.m2/repository/edu/stanford/nlp/stanford-corenlp/3.5.2/stanford-srparser-2014-10-23-models.jar
That is the same directory as the core dependency jar
~/.m2/repository/edu/stanford/nlp/stanford-corenlp/3.5.2/stanford-corenlp-3.5.2.jar
Here is the relevant portion of my project's pom.xml:
<dependency>
<groupId>edu.stanford.nlp</groupId>
<artifactId>stanford-corenlp</artifactId>
<version>3.5.2</version>
</dependency>
<dependency>
<groupId>edu.stanford.nlp</groupId>
<artifactId>stanford-corenlp</artifactId>
<version>3.5.2</version>
<classifier>models</classifier>
</dependency>
Compiling is successful:
mvn clean compile
But when I try to load the app, I receive:
java.lang.reflect.InvocationTargetException
...
Caused by: edu.stanford.nlp.io.RuntimeIOException: java.io.IOException: Unable to resolve "edu/stanford/nlp/models/srparser/englishSR.ser.gz" as either class path, filename or URL
I unzipped the compiled project war, and "edu/stanford/nlp/models/srparser/englishSR.ser.gz" is not present.
Here is how I'm calling the model in my app:
// Initialize a CoreNLP pipeline
public static Properties props = new Properties();
public static StanfordCoreNLP pipeline;
// Set the CoreNLP pipeline annotators.
props.setProperty("annotators", "tokenize, ssplit, parse, sentiment");
props.setProperty("parse.model", "edu/stanford/nlp/models/srparser/englishSR.ser.gz");
pipeline = new StanfordCoreNLP(props);
How can I update my Maven config to force my CoreNLP dependency to include the srparser model? Keep in mind that I need this configuration to run in other developers' environments, so the solution should be clean and reusable if possible.
Thanks!
EDIT:
In response to #jah's comment, below are the results of mvn dependency:tree. The build succeeds, but the srparser model is not compiled/present:
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # [REDACTED] ---
Downloading:
...
[INFO] com.[REDACTED].nlp:nlp:war:0.1.0
[INFO] +- com.strategicgains:RestExpress:jar:0.11.2:compile
[INFO] | +- com.strategicgains:RestExpress-Common:jar:0.11.2:compile
[INFO] | +- com.strategicgains:DateAdapterJ:jar:1.1.4:compile
[INFO] | +- com.thoughtworks.xstream:xstream:jar:1.4.7:compile
[INFO] | | +- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO] | | \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] | +- io.netty:netty-all:jar:4.0.29.Final:compile
[INFO] | +- org.owasp.encoder:encoder:jar:1.1.1:compile
[INFO] | \- com.jcraft:jzlib:jar:1.1.3:compile
[INFO] +- junit:junit:jar:4.11:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- edu.stanford.nlp:stanford-corenlp:jar:3.5.2:compile
[INFO] | +- com.io7m.xom:xom:jar:1.2.10:compile
[INFO] | | +- xml-apis:xml-apis:jar:1.3.03:compile
[INFO] | | +- xerces:xercesImpl:jar:2.8.0:compile
[INFO] | | \- xalan:xalan:jar:2.7.0:compile
[INFO] | +- joda-time:joda-time:jar:2.1:compile
[INFO] | +- de.jollyday:jollyday:jar:0.4.7:compile
[INFO] | | \- javax.xml.bind:jaxb-api:jar:2.2.7:compile
[INFO] | +- com.googlecode.efficient-java-matrix-library:ejml:jar:0.23:compile
[INFO] | \- javax.json:javax.json-api:jar:1.0:compile
[INFO] +- edu.stanford.nlp:stanford-corenlp:jar:models:3.5.2:compile
[INFO] +- org.json:json:jar:20151123:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.6.4:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.6.0:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.6.4:compile
[INFO] \- commons-io:commons-io:jar:1.3.2:compile
First, download the srparser jar and place it in your project root: http://nlp.stanford.edu/software/stanford-srparser-2014-10-23-models.jar
Second, from the project root, execute the following command to install the srparser model dependency via Maven:
mvn install:install-file -Dfile=stanford-srparser-2014-10-23-models.jar -DgroupId=edu.stanford.nlp -DartifactId=stanford-srparser -Dversion=3.5.2 -Dpackaging=jar
Note the custom artifactId and lack of classifier in the command -- this is to prevent namespace confusion with the other CoreNLP modules.
Third, add the dependency to the Maven project's pom.xml:
<dependencies>
...
<dependency>
<groupId>edu.stanford.nlp</groupId>
<artifactId>stanford-srparser</a‌​rtifactId>
<version>3.5.2</version>
</dependency>
...
</dependencies>
Finally, clean install:
mvn clean install
If you continue to experience issues, it may be helpful to clear your Maven dependencies:
mvn dependency:purge-local-repository
And don't forget to add the download/install commands to your project README/environment bootstrap file!
(Thanks for your help #jah and #GaborAngeli.)
To run the shift-reduce parser, you need to include the shift-reduce models jar, which can be found at: http://nlp.stanford.edu/software/srparser.shtml
Not sure if it's on maven, but it appears not?
If you run the mvn command from the folder where the stanford-srparser-2014-10-23-models.jar is placed, then the following command should do the trick.
mvn install:install-file -Dfile=stanford-srparser-2014-10-23-models.jar -DgroupId=edu.stanford.nlp -DartifactId=stanford-corenlp -Dversion=3.5.2 -Dclassifier=models -Dpackaging=jar

Maven brings "test" transitive dependency as "compile"

When I run "mvn dependency:tree" for my project it shows the following:
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # xxxxx ---
[INFO] com.xxx.xxx:xxxxx:war:3.1.0-SNAPSHOT
...
[INFO] +- commons-configuration:commons-configuration:jar:1.5:compile
[INFO] | \- commons-beanutils:commons-beanutils-core:jar:1.7.0:compile
[INFO] +- org.seleniumhq.selenium:selenium-api:jar:2.34.0:test
[INFO] | +- com.google.guava:guava:jar:14.0:test
[INFO] | \- org.json:json:jar:20080701:test
[INFO] +- org.seleniumhq.selenium:selenium-htmlunit-driver:jar:2.34.0:test
[INFO] | +- org.seleniumhq.selenium:selenium-remote-driver:jar:2.34.0:test
[INFO] | | +- cglib:cglib-nodep:jar:2.1_3:test
[INFO] | | +- net.java.dev.jna:jna:jar:3.4.0:test
[INFO] | | \- net.java.dev.jna:platform:jar:3.4.0:test
[INFO] | \- net.sourceforge.htmlunit:htmlunit:jar:2.12:test
[INFO] | +- org.apache.commons:commons-lang3:jar:3.1:test
[INFO] | +- org.apache.httpcomponents:httpmime:jar:4.2.3:test
[INFO] | +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.12:test
[INFO] | +- xerces:xercesImpl:jar:2.10.0:test
>>>[INFO] | | \- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] | +- net.sourceforge.nekohtml:nekohtml:jar:1.9.18:test
[INFO] | +- net.sourceforge.cssparser:cssparser:jar:0.9.9:test
[INFO] | | \- org.w3c.css:sac:jar:1.3:test
[INFO] | \- org.eclipse.jetty:jetty-websocket:jar:8.1.9.v20130131:test
[INFO] +- org.seleniumhq.selenium:selenium-firefox-driver:jar:2.34.0:test
...
As you see on the marked line, the xml-apis has "compile" scope, and as result it is packed into .war file. Why could it happen?
More interestingly it happens only while Java5 is used, for Java6 the dependency appears as "test".
Maven version: 3.0.4
Study the output of the following Maven command.
mvn -X dependency:tree -Dverbose
That should tell you why Maven upgraded the scope from test to compile.
If you take a look at xercesImpl it contains a dependency to xml-apis:xml-apis:jar:1.4.01:compile with the scope compile so the display of dependency plugin is correct. The usage of -Dverbose will do things as written in the docs:
Whether to include omitted nodes in the serialized dependency tree.
Apart from the above a test dependency as in your case is never being packaged into a war file.
There must be an other source of the same dependency which causes the packaging into the war
Furthermore the change in behaviour in relationship with adding explicit xml-apis to your pom is a supplemental evidence for this.
I had a similar problem.
In my case an entry in the dependencyManagement of a parent pom set the scope of the dependent artefact to compile. Actually I omitted the scope tag which effectively is the same as setting it to compile. Changing it to provided helped.
Seems the scope in dependencyManagement takes precedence over the transitive scope. Which makes sense but can still cause confusion when all you wanted to do is define the version.
It was actually not hard to spot: Looking at the effective-pom showed the dependencyManagement entry.

Maven Dependancy Refereing old Poi Version

I am using Apache Poi version 3.8 in my POM. But it is still downloading poi-3.2 along with poi-3.8 as (may be) due to some internal dependency. The strange behavior for me is My project using poi-3.2 when even I have mentioned 3.8 version in POM. I have Googled a lot for the same, but found myself unlucky.
Here is my POM entry :
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.8</version>
<type>jar</type>
</dependency>
I have checked the poi jar my project using in classpath by the code:
ClassLoader classloader =
org.apache.poi.poifs.filesystem.POIFSFileSystem.class.getClassLoader();
URL res = classloader.getResource(
"org/apache/poi/poifs/filesystem/POIFSFileSystem.class");
String path = res.getPath();
System.out.println("Core POI came from " + path);
This prints :
Core POI came from file:/D:/Software/Softwares/apache-tomcat-6.0.33/webapps/scd-web/WEB-INF/lib/poi-3.2.jar!/org/apache/poi/poifs/filesystem/POIFSFileSystem.class
There is a poi-3.8.jar in same folder but classpath picking up 3.2.
My question is :
What should I do to so that My project uses poi-3.8.jar instead of poi-3.2.jar.
Many Thanks !!
Edited:
Output of mvn dependency:tree
[INFO] Building SCD-common [INFO] task-segment: [dependency:tree]
[INFO]
------------------------------------------------------------------------
[WARNING] While downloading xmlbeans:xmlbeans:2.3.0 This artifact has been relocated to org.apache.xmlbeans:xmlbeans:2.3.0.
[INFO] [dependency:tree] [INFO] com.idc:scd-common:jar:4.2.0.5
[INFO] +- org.springframework:spring-webmvc:jar:2.5.6:compile
[INFO] | +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] | +- org.springframework:spring-beans:jar:2.5.6:compile
[INFO] | +- org.springframework:spring-context-support:jar:2.5.6:compile
[INFO] | \- org.springframework:spring-web:jar:2.5.6:compile
[INFO] +- com.idc.worldwide.keystones:service-single-signon-dynamo-api:jar:1.0:compile
[INFO] +- com.idc.worldwide.keystones:service-single-signon-dynamo-database-impl:jar:1.0.3:compile
[INFO] | +- org.apache:commons-dbcp:jar:1.2.2:compile
[INFO] | +- org.apache:commons-pool:jar:1.4:compile
[INFO] | \- com.idc.worldwide.webchannel:sage-core:jar:3.2.0.001:compile
[INFO] | +- com.idc.webchannel.legacy.sage-dependencies:aspose-slides:jar:1. 0:compile
[INFO] | +- com.servlets:cos:jar:09May2002:compile
[INFO] | +- com.sun:jai_codec:jar:1.1.3:compile
[INFO] | +- com.sun:jai_core:jar:1.1.3:compile
[INFO] | +- com.verity:k2:jar:5.00.3177.0:compile
[INFO] | +- org.apache:poi:jar:3.2:compile
[INFO] | +- org.apache:poi_contrib:jar:3.2:compile
[INFO] | +- org.apache:poi_scratchpad:jar:3.2:compile
[INFO] | \- org.springframework:spring:jar:2.5.6:compile
[INFO] +- org.springframework:spring-core:jar:3.0.5.RELEASE:compile
[INFO] | \- org.springframework:spring-asm:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-aop:jar:3.0.5.RELEASE:compile
There are various mvn command to help solving this issue:
mvn dependency:analyze-dep-mgt
will print details about dependency resolving.
mvn dependency:tree
will print the dependency tree (very helpful to see dependencies of your dependencies)
mvn help:effective-pom
will print the pom resulting from the merge of your pom hierarchy.
If you don't find any references to poi-3.2 with maven, you can take a look at your classpath in your IDE. Do you add any jar by-passing maven ?
Editing your question with the result of those commands can be useful for us to help you.
Looks like
org.apache:poi:jar:3.2
is a compile dependency of
com.idc.worldwide.keystones:service-single-signon-dynamo-database-impl
(although I think you may have cut something)
and
org.apache.poi:poi:jar:3.8
is not a dependency (it's not in the dependency tree).
Make sure your <dependency> entry is within the <dependencies> tag.
Run
mvn dependency:tree
to check which library has a transitive dependency to poi 3.2. You can then exclude it in your pom.
<dependency>
<groupId>sample.group</groupId>
<artifactId>sample-artifactB</artifactId>
<version>1</version>
<exclusions>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
</exclusion>
</exclusions>
</dependency>
Maybe you are mixing normal dependency with plugin dependency, see here (not too fitting answer).
Use dependency management in the root POM if you have child projects.

Categories