本文介绍了如何从阴影jar中排除* .DSA和* .SF文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在pom.xml中有一个部分

I have a section in pom.xml

 <filters>
   <filter>
      <artifact>*:*</artifact>
         <excludes>
            <exclude>META-INF/*.SF</exclude>
            <exclude>META-INF/*.DSA</exclude>
         </excludes>
   </filter>
</filters>

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

I want to exclude *.SF and *.DSA files from final jar.But I get the following message:

[INFO] No artifact matching filter *:*

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

and files are not excluded.Does anyone know how to overcome it?

推荐答案

我遇到了同样的问题。通过使我的工件选择器更具体来修复它,例如

I had the same problem. It was fixed by making my artifact selector more specific, e.g.

<artifact>bouncycastle:*</artifact>

整个区块如下所示:

The entire block looks like this:

<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>

这篇关于如何从阴影jar中排除* .DSA和* .SF文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 03:08