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
Related
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.
I have a maven project that was imported as java project. When I run it, I get
Handling error: NestedServletException, Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: org.apache.commons.lang.time.DateUtils.addDays(Ljava/util/Date;I)Ljava/util/Date;
Using this answer I got this line:
[Loaded org.apache.commons.lang.time.DateUtils from file:/C:/Users/user/.m2/repository/commons-lang/commons-lang/2.0/commons-lang-2.0.jar]
But at pom.xml it's:
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
Considering I have this libs at Java Build Path:
and
How could I resolve this problem? Where can I assured compare my run vs compile libs?
EDIT
this is the output of mvn dependency:tree -Dverbose -Dincludes=commons-lang:
[INFO] com.companyName.gestao.projectName:projectName-webapp:war:1.0.0-SNAPSHOT
[INFO] \- com.companyName.gestao.projectName:projectName-business:jar:1.0.0-SNAPSHOT:compile
[INFO] +- com.companyName.commons.utils:companyName-commons-utils:jar:1.14.5:compile
[INFO] | \- softdes:softdes-all:jar:1.6.23:compile
[INFO] | \- commons-lang:commons-lang:jar:2.6:compile (version managed from 2.0)
[INFO] \- net.sf.jasperreports:jasperreports:jar:companyName-6.4.0.4:compile
[INFO] \- org.codehaus.castor:castor-xml:jar:1.3.3:compile
[INFO] +- org.codehaus.castor:castor-core:jar:1.3.3:compile
[INFO] | \- (commons-lang:commons-lang:jar:2.6:compile - version managed from 2.0; omitted for duplicate)
[INFO] \- (commons-lang:commons-lang:jar:2.6:compile - version managed from 2.0; omitted for duplicate)
Running the same command at business subproject(at same directory level that webapp project):
[INFO] com.companyName.gestao.projectName:projectName-business:jar:1.0.0-SNAPSHOT
[INFO] +- com.companyName.commons.utils:companyName-commons-utils:jar:1.14.5:compile
[INFO] | \- softdes:softdes-all:jar:1.6.23:compile
[INFO] | \- commons-lang:commons-lang:jar:2.0:compile
So webapp depends upon business that depends upon companyName-commons-utils that depends upon softdes-all that depends upon commons-lang version 2. But webapp must use commons-lang version 2.6.
Can I accomplish this by changing dependency order at pom.xml?
SECOND EDIT
After adding <exclusion> to commons-lang at business dependency, I run dependency tree maven as stated above. Now, besides BUILD SUCCESS, maven doesn't have any tree printed, as below:
PS C:\workspace\projectName-dev\webapp> mvn dependency:tree -Dverbose -Dincludes=commons-lang
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Conciliador - webapp 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) # conciliador-webapp ---
[WARNING] Using Maven 2 dependency tree to get verbose output, which may be inconsistent with actual Maven 3 resolution
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.629s
[INFO] Finished at: Thu May 17 13:21:08 BRT 2018
[INFO] Final Memory: 29M/494M
[INFO] ------------------------------------------------------------------------
PS C:\workspace\projectName-dev\webapp>
I discovered that commons-lang dependency is inside dependencyManagement as stated here and DateUtils is still loaded from 2.0 version Jar. What could be done?
As #LuisMuñoz stated on comments, I added exclusions to all possible libs using older dependencies. Even with this Eclipse insisted in using older versions of it. I went to project Properties > Java Build Path > Order and Export and top prioritized over everything else my newer dependency version 2.6. After this it worked. Sounds like pom definitions doesn't matter at all if is Eclipse configs that have the final word.
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
I'm working on a project that uses Maven for dependency / building / whatever (project life cycle management or sth), and I'm using Eclipse to develop and test.
The project uses Vert.x (latest) and I'm trying to use Hazelcast for some cluster management, but I encountered a bug with the Hazelcast version that Vert.x declares as a dependency (3.6.3) and the solution apparently is to upgrade to a more recent version.
I've added an updated Hazelcast dependency in my pom.xml as such:
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast</artifactId>
<version>[3.7,)</version>
</dependency>
And maven indeed updates the dependency (actually Eclipse called maven to update as soon as I save the pom.xml file - pretty neat), and so I get the dependency tree:
$ mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building project 3.8.4
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for jfree:jfreechart:jar:1.0.8 is missing, no dependency information available
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # project ---
[INFO] my.group:project:jar:3.8.4
[INFO] +- some.private.dep ...
[INFO] | +- org.junit:junit4-engine:jar:5.0.0-ALPHA:compile (version selected from constraint [4,))
[INFO] | | \- org.junit:junit-engine-api:jar:5.0.0-ALPHA:compile
[INFO] | | +- org.junit:junit-commons:jar:5.0.0-ALPHA:compile
[INFO] | | \- org.opentest4j:opentest4j:jar:1.0.0-ALPHA:compile
[INFO] | +- io.vertx:vertx-hazelcast:jar:3.3.3:compile (version selected from constraint [3.0.0,))
[INFO] | \- io.vertx:vertx-web:jar:3.4.0.Beta1:compile (version selected from constraint [3.0.0,))
[INFO] | \- io.vertx:vertx-auth-common:jar:3.4.0.Beta1:compile
[INFO] +- io.vertx:vertx-core:jar:3.4.0.Beta1:compile
[INFO] | +- io.netty:netty-common:jar:4.1.8.Final:compile
[INFO] | +- io.netty:netty-buffer:jar:4.1.8.Final:compile
[INFO] | +- io.netty:netty-transport:jar:4.1.8.Final:compile
[INFO] | +- io.netty:netty-handler:jar:4.1.8.Final:compile
[INFO] | | \- io.netty:netty-codec:jar:4.1.8.Final:compile
[INFO] | +- io.netty:netty-handler-proxy:jar:4.1.8.Final:compile
[INFO] | | \- io.netty:netty-codec-socks:jar:4.1.8.Final:compile
[INFO] | +- io.netty:netty-codec-http:jar:4.1.8.Final:compile
[INFO] | +- io.netty:netty-codec-http2:jar:4.1.8.Final:compile
[INFO] | +- io.netty:netty-resolver:jar:4.1.8.Final:compile
[INFO] | \- io.netty:netty-resolver-dns:jar:4.1.8.Final:compile
[INFO] | \- io.netty:netty-codec-dns:jar:4.1.8.Final:compile
[INFO] +- junit:junit:jar:4.12:test
...
[INFO] +- com.hazelcast:hazelcast:jar:3.8-EA:compile
[INFO] \- org.slf4j:slf4j-jdk14:jar:1.7.22:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.785 s
[INFO] Finished at: 2017-02-06T09:52:46+02:00
[INFO] Final Memory: 25M/435M
[INFO] ------------------------------------------------------------------------
When I run mvn package to create the shaded Jar, I get the correct version of Hazelcast.
The problem is that if I create an Eclipse launch configuration for running the project or its unit tests, it inserts both the old version of Hazelcast as well as the new version of Hazelcase into the classpath - here's an example command line from a unit test being run:
/usr/lib/jvm/java-8-openjdk-amd64/bin/java -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:33123 -ea -Dfile.encoding=UTF-8
-classpath ...:
$HOME/.m2/repository/io/vertx/vertx-hazelcast/3.3.3/vertx-hazelcast-3.3.3.jar:
$HOME/.m2/repository/com/hazelcast/hazelcast/3.6.3/hazelcast-3.6.3.jar:
...
$HOME/.m2/repository/com/hazelcast/hazelcast/3.8-EA/hazelcast-3.8-EA.jar:
...
-version 3 -port 38387 -testLoaderClass org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader
-loaderpluginname org.eclipse.jdt.junit4.runtime
-classNames my.group.project.SomeTest
Now because both versions are loaded into the classpath, the first one (the older) "wins" and I get the bug instead of getting the newer fixed version.
The launch configuration "Classpath" tab looks very standard:
+ Bootstrap Entries
\- JRE System Library
+ User Enties
\- project
\- Maven Dependencies
And the "Maven Dependencies" "folder" in the "Project Explorer" view shows only the newer Hazelcast version.
What is going on?
Update:
As per the discussion in the comments, I added exclusions to the pom.xml file to prevent vertx-hazelcast from adding the old hazelcast dependency. Because vertx-hazelcast is loaded from yet another (private) dependency, the new setup is a bit more involved and looks like this:
<dependency>
<groupId>some.private</groupId>
<artifactId>dependency</artifactId>
<version>[1.3,)</version>
<exclusions>
<exclusion>
<groupId>io.vertx</groupId>
<artifactId>vertx-hazelcast</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-core</artifactId>
<version>[3.0.0,)</version>
</dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast</artifactId>
<version>[3.7,)</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-hazelcast</artifactId>
<version>[3.0.0,)</version>
<exclusions>
<exclusion>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast</artifactId>
</exclusion>
</exclusions>
</dependency>
I then removed the old launch configuration and recreated it (by right clicking the JUnit test case and choosing "Debug as Junit") - But that does not change the Eclipse behavior - some jars in the classpath have moved around a bit, but the result is still that vertx-hazelcast and its hazelcast-3.6.3.jar dependency are loaded before hazelcast-3.8.jar.
Note This answer is a summary from discussion with the OP
It looks like vertex-hazelcast declares both compile and test scoped dependencies on hazelcast. These scopes are not transitive so it's my understanding that this version will be included in the classpath by design. #Echnalb suggestion to use an exclusion is the recommended way to resolve this.
As that hasn't worked, it could be an ancestor is also declaring a dependency which would also need to be excluded.
After looking through some other dependencies that were declared in vertex-hazelcast, I checked hazelcast-client to see if it also declared a dependency on the earlier version of hazelcast the assumption being that the ancestral dependency was being added to the classpath despite the exclusion from the parent.
It did include such a dependency:
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast</artifactId>
<scope>test</scope>
<version>${project.parent.version}</version>
<classifier>tests</classifier>
</dependency>
I suggest(ed) adding an exclusion for hazelcast-client which seems to have solved the problem.
#Guss comments
Prior to the exclusion, running dependency:tree, hazelcast-client is
not listed at all
It is interesting that dependency:tree does not detect test scoped dependencies. Is there's a way to force it to switch scopes?
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.