我刚刚将 eclipse birt 的依赖项添加到我的项目中,现在发生了非常奇怪的失败:
java.lang.SecurityException: sealing violation: package org.apache.derby.impl.store.raw.xact is sealed
集成测试或
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'.
谷歌搜索第一个点,发现 Derby 可能存在依赖冲突。
mvn dependency:list
证明了这一点。 birt 需要 derby 10.5,而我们的一个 jar 需要 10.8。因此,两个 derby 依赖关系都是可传递的(birts 依赖关系更加间接 - 树中更深一层)。
如何解决这个/这样的冲突?
(更改 pom 中的顺序没有帮助)
与此同时,我尝试了 Dan Matthews-Grout 的答案 - 现在它起作用了:
<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>
错误是相同的,并且“mvn dependency:list”没有改变。依赖关系 ist Charts->birt->derby 树的相关部分:
+- <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
最佳答案
您可以使用以下方法从其中一个条目中排除传递依赖:
<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
关于java - 对 derby 与 Maven 3 的依赖冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12352960/