发行说明中的 Axiom 1.2.15 发行版状态:
The implementation JARs (axiom-impl and axiom-dom) are now built with AspectJ (to reduce source code duplication) and contain a small subset of classes from the AspectJ runtime library. There is a small risk that this may cause conflicts with other code that uses AspectJ.
嗯,这确实导致我的 AspectJ 1.9.2 项目出现问题。 Maven 抱怨:
09:35:12,617 [WARNING] Found duplicate and different classes in [org.apache.ws.commons.axiom:axiom-dom:1.2.21, org.apache.ws.commons.axiom:axiom-impl:1.2.21, org.aspectj:aspectjrt:1.9.2, org.aspectj:aspectjweaver:1.9.2]:
09:35:12,619 [WARNING] org.aspectj.lang.annotation.Aspect
我不能将 Axiom 从我们的项目中排除,因为它是由 Axis 引入的。是否有不包含 AspectJ 类的 Axiom 发行版,还是我需要构建自己的一个发行版?
这将在 Axiom 1.2.23 中被修复。
要解决与 axiom-dom 和 axiom-impl 中重复类 Aspect.class 相关的问题,您需要在 pom.xml 文件的
<dependencyManagement>
部分添加以下依赖项。
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.9.9.1</version>
<scope>runtime</scope>
</dependency>