Reputation: 4200
Maven puts both axis-1.3.jar and axis-1.4.jar to WEB-INF/lib of my war. Can someone explain how to tell it to use only axis-1.4.jar?
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>dummy</groupId>
<artifactId>test-war</artifactId>
<version>0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>dummy</groupId>
<artifactId>war-part2</artifactId>
<name>war-part1</name>
<version>0.1</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>com.jaspersoft.jasperserver</groupId>
<artifactId>jasperserver-ireport-plugin</artifactId>
<version>2.0.1</version>
</dependency>
</dependencies>
</project>
[dependency:tree {execution: default-cli}]
+- org.apache.axis:axis:jar:1.4:compile
\- com.jaspersoft.jasperserver:jasperserver-ireport-plugin:jar:2.0.1:compile
+- javax.activation:activation:jar:1.1:compile
+- javax.mail:mail:jar:1.4:compile
+- log4j:log4j:jar:1.2.12:compile
\- com.jaspersoft.jasperserver:jasperserver-common-ws:jar:2.0.1:compile
+- xerces:xercesImpl:jar:2.8.1:compile
| \- xml-apis:xml-apis:jar:1.3.03:compile
\- axis:axis:jar:1.3:compile
+- axis:axis-jaxrpc:jar:1.3:compile
+- axis:axis-saaj:jar:1.3:compile
+- wsdl4j:wsdl4j:jar:1.5.1:compile
+- commons-logging:commons-logging:jar:1.0.4:compile
\- commons-discovery:commons-discovery:jar:0.2:compile
Maven is 2.2.1
Upvotes: 5
Views: 3912
Reputation: 4822
fwiw i've been banging on maven for a few hours because my war had other versions of the same jar in it - always use caution when doing a recursive delete but this is what cleared it up in the end
rm -fR ~/.m2/repository
mvn -U clean package
something was wacky in my repo but whatever it was it kept coming back until i did the force update -U
Hope this helps someone
Upvotes: 0
Reputation: 23633
This comes up at work all the time and 90% of the time it is due to someone (or Eclipse's WTP
) putting a copy of the jar in WEB-INF/lib
and then checking that into version control.
You might want to check that.
Upvotes: 4
Reputation: 570615
In theory, Maven should handle the convergence of the version of an artifact present in dependencies or transitive dependencies. The problem here is that axis-1.4.jar
and axis-1.3.jar
don't have the same groupId
(org.apache.axis
vs axis
) so Maven see them as distinct artifacts and include them both.
If you don't want to get axis-1.3.jar
but only axis-1.4.jar
, you'll have to exclude the unwanted from the jasperserver-ireport-plugin
dependency explicitly using an exclusion
:
<dependency>
<groupId>com.jaspersoft.jasperserver</groupId>
<artifactId>jasperserver-ireport-plugin</artifactId>
<version>2.0.1</version>
<exclusions>
<exclusion>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
</exclusion>
</exclusions>
</dependency>
Can't say if jasperserver-ireport-plugin
will work with axis-1.4.jar
though.
Upvotes: 8
Reputation: 35341
You can exclude certain dependent libraries in your dependencies :
<dependency>
<groupId>com.jaspersoft.jasperserver</groupId>
<artifactId>jasperserver-ireport-plugin</artifactId>
<version>2.0.1</version>
<exclusions>
<exclusion>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
</exclusion>
</exclusions>
</dependency>
Then maven will skip this dependency.
You must be sure though that Jasper can find the needed classes in the library you provide.
Upvotes: 6