dermoritz
dermoritz

Reputation: 13011

conflicting dependency on derby with maven 3

i just added dependency to eclipse birt to my project now very odd failures occur:

java.lang.SecurityException: sealing violation: package org.apache.derby.impl.store.raw.xact is sealed

on integration test or

java.sql.SQLException: Catalogs at version level 'null' cannot be upgraded to version level '10.5'.
ERROR XCL20: Catalogs at version level 'null' cannot be upgraded to version level '10.5'.

googling for the first points to a possible dependency conflict on derby.

mvn dependency:list

is proving this. birt need derby 10.5 and one of our jars need 10.8. So both derby dependencies are transitive (birts dependency is more indirect - one level deeper in tree).

How to solve this /such an conflict?

(changing the order in pom doesn't helped)

in meanwhile i tried the answer by Dan Matthews-Grout - now it works:

        <dependency>
        <groupId>de.stalabw</groupId>
        <artifactId>charts</artifactId>
        <version>0.0.2</version>
        <exclusions>
            <exclusion>
                <!-- does not work<groupId>org.apache.derby</groupId> but this:-->
                <groupId>org.eclipse.birt.runtime.3_7_1</groupId>
                <artifactId>derby</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

the errors are the same and "mvn dependency:list" hasn't changed. the dependency ist charts->birt->derby the relevant parts of tree:

+- <myPackage.myProject>:metaDataService:jar:1.8.0:compile
|  +- org.apache.derby:derby:jar:10.8.1.2:compile
 ...
\- <myPackage>:charts:jar:0.0.2:compile
    \- org.eclipse.birt.runtime:org.eclipse.birt.runtime:jar:4.2.0:compile
      ...
      +- org.eclipse.birt.runtime.3_7_1:derby:jar:10.5.1000001:compile

Upvotes: 0

Views: 831

Answers (1)

Dan
Dan

Reputation: 1018

You can exclude the transitive dependency from one of the entries using:

<dependency>
  <groupId>sample.ProjectA</groupId>
  <artifactId>Project-A</artifactId>
  <version>1.0</version>
  <scope>compile</scope>
  <exclusions>
    <exclusion>  <!-- declare the exclusion here -->
      <groupId>sample.ProjectB</groupId>
      <artifactId>Project-B</artifactId>
    </exclusion>
  </exclusions> 
</dependency>

http://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html

Upvotes: 2

Related Questions