我正在尝试过滤我的jar中包含的资源。我使用shade-maven-plugin,它会将所有依赖项的资源添加到生成的jar中,但我只想包含项目资源。
这是我的pom定义:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>es.app.applet.MyApplet</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</plugin>
我尝试添加下一个过滤器来删除所有资源,然后再添加另一个过滤器,只添加我的artifactID资源,但它不起作用。
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>resources/*.*</exclude>
</excludes>
</filter> <filter>
<artifact>my.groupId:my.artifactId</artifact>
<includes>
<include>resources/*.*</include>
</includes>
</filter>
有什么想法?
谢谢。