Maven waging war on two versions of the same jar

Maven puts both axis-1.3.jar and axis-1.4.jar on the WEB-INF / lib of my war. Can someone explain how to tell him 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 - 2.2.1

+5
source share
4 answers

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 that Jasper can find the necessary classes in the library you provide.

+6
source

, Maven , . , axis-1.4.jar axis-1.3.jar groupId (org.apache.axis vs axis), Maven .

axis-1.3.jar, axis-1.4.jar, jasperserver-ireport-plugin , 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>

, jasperserver-ireport-plugin axis-1.4.jar.

+8

90% , - (or Eclipse WTP) WEB-INF/lib, .

, .

+4

fwiw I've been knocking on maven for several hours, because in my war there were different versions of the same jar - always be careful when doing a recursive delete, but this is what cleared it at the end

rm -fR ~/.m2/repository
mvn -U clean package

there was something strange in my repo, but whatever it was, it came back until I updated the force -U

Hope this helps someone

0
source

All Articles