本文介绍了排除阴影罐中包含的类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图排除某些类被包含在阴影罐中。
I'm trying to exclude certain classes from being included in a shaded jar.
我尝试了几种不同的配置但由于某种原因仍然包含了罐子在我的罐子里。以下是插件设置:
I have tried several different configurations but for some reason the jars are still being included in my jar. Here is the plugin setup:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>java/*</exclude>
</excludes>
</filter>
</filters>
</configuration>
</plugin>
我也尝试过以下模式:
<exclude>java.*</exclude>
<exclude>java.util.concurrent.ConcurrentHashMap</exclude>
<exclude>java/util/concurrent/ConcurrentHashMap</exclude>
其中没有一个实际上从我的jar中排除了该文件。如何从我的jar中排除这个类?
None of which have actually excluded the file from my jar. How can I exclude this class from my jar?
推荐答案
您只排除java文件夹中的顶级文件。您可以像这样递归排除:
You are only excluding top level files in the java folder. You can exclude recursively like this:
<exclude>java/**/*</exclude>
这篇关于排除阴影罐中包含的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!