0

I am trying to add jdom 2.0.2 dependency in one of my project.In order to do that I added following entry in pom.xml

<dependency>
  <groupId>org.jdom</groupId>
  <artifactId>jdom</artifactId>
  <version>2.0.2</version>
</dependency>

But after building the project I found that both jdom 1.0 and jdom 2.0.2 got copied. Then I ran mvn dependency:tree command which shows that jdom 1.0 jars are coming from jaxen 1.1 dependency through transitive dependency. To exclude that dependency I added an exclusions in jaxen dependency

<dependency>
      <groupId>jaxen</groupId>
      <artifactId>jaxen</artifactId>
      <version>1.1</version>
      <exclusions>
        <exclusion>
          <groupId>org.jdom</groupId>
          <artifactId>jdom</artifactId>
        </exclusion>
       </exclusions>
    </dependency>

But still I am facing same issue. Both(jdom 1.0 and 2.0.2) jars are getting copied. mvn dependency:tree also is showing the same result

INFO] +- jaxen:jaxen:jar:1.1:compile
INFO] |  +- dom4j:dom4j:jar:1.6.1:compile
INFO] |  +- jdom:jdom:jar:1.0:compile

Could you please help on this issue?

Thanks

Rahman
  • 3,755
  • 3
  • 26
  • 43

1 Answers1

1

Look carefully at the dependency output:

INFO] +- jaxen:jaxen:jar:1.1:compile
INFO] |  +- dom4j:dom4j:jar:1.6.1:compile
INFO] |  +- jdom:jdom:jar:1.0:compile

The group ID for the jdom dependency is just jdom, not org.jdom. Fix the exclusion and that should do it.

<exclusion>
    <groupId>jdom</groupId>
    <artifactId>jdom</artifactId>
</exclusion>
user944849
  • 14,524
  • 2
  • 61
  • 83