java – 如何从阴影jar中排除* .DSA和* .SF文件?

前端之家收集整理的这篇文章主要介绍了java – 如何从阴影jar中排除* .DSA和* .SF文件?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在pom.xml中有一个部分
<filters>
   <filter>
      <artifact>*:*</artifact>
         <excludes>
            <exclude>Meta-INF/*.SF</exclude>
            <exclude>Meta-INF/*.DSA</exclude>
         </excludes>
   </filter>
</filters>

我想从最后的jar中排除* .SF和* .DSA文件.
但是我收到以下消息:

[INFO] No artifact matching filter *:*

并且不排除文件.
有谁知道如何克服它?

解决方法

我有同样的问题.它是通过使我的神器选择器更具体的固定,例如
<artifact>bouncycastle:*</artifact>

整个块看起来像这样:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
            <configuration>
                <transformers>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                        <mainClass>com.mycompany.MainClass</mainClass>
                    </transformer>
                </transformers>
                <filters>
                    <filter>
                        <artifact>bouncycastle:*</artifact>
                        <excludes>
                            <exclude>Meta-INF/*.SF</exclude>
                            <exclude>Meta-INF/*.DSA</exclude>
                            <exclude>Meta-INF/*.RSA</exclude>
                        </excludes>
                    </filter>
                </filters>
                <shadedArtifactAttached>true</shadedArtifactAttached>
                <shadedClassifierName>standalone</shadedClassifierName>
            </configuration>
        </execution>
    </executions>
</plugin>
<plugin>
原文链接:https://www.f2er.com/java/121929.html

猜你在找的Java相关文章