我用maven-shade-plugin建了一个项目,但是遇到了一个我处理不了的问题。有两个jar几乎有相同的类并且路径相同,aspectjweaver.jar和aspectjrt.jar,当打包jar,我得到警告“重复的类已经存在于......”。我尝试使用“重定位”属性来重定位类,但问题是,如何重新识别两个 jar 中的类?接下来是我的 Pom.xml 的一部分。org.apache.maven.plugins maven-shade-plugin 1.3.1
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>org.aspectj:aspectjrt</artifact>
<includes>
<include>*</include>
</includes>
</filter>
</filters>
<relocations>
<relocation>
<pattern>org.aspectj</pattern>
<shadedPattern>hide.org.aspectj</shadedPattern>
</relocation>
</relocations>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>cm.data.DatBoostrap</mainClass>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>