java通过Maven build排除了一些类
我正在将一个基于Gradle的Android项目转换为Maven,并且在包含SimpleXML Framework时遇到了一个减速
在Gradle中,我可以在导入库时指定以下内容:
compile('org.simpleframework:simple-xml:2.7.+') {
exclude module: 'stax'
exclude module: 'stax-api'
exclude module: 'xpp3'
请问我在Maven怎么做?我试过使用Shade插件,但我想我把它弄得一团糟。以下是我的尝试:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<excludes>
<exclude>stax</exclude>
<exclude>stax-api</exclude>
<exclude>xpp3</exclude>
</excludes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
# 1 楼答案
我想你想要的是这样描述的: https://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html
基本上,在要排除某些内容的库的
<depdency>
标记中,添加<exclusions>
。链接中的示例:# 2 楼答案
试着使用maven编译器插件,它对我很有用