如何排除 *.每日生活津贴和*。SF 文件来自阴影罐?

2022-09-04 08:01:59

我有一个部分在pom中.xml

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

我想排除 *。SF 和 *.来自最终罐子的 DSA 文件。但我收到以下消息:

[INFO] No artifact matching filter *:*

和文件未被排除。有谁知道如何克服它?


答案 1

实际上,您可以在不需要指定组ID的情况下进行全局过滤,只需要使用正确的通配符语法即可。如果要排除所有 *。例如,jar 中的 RSA 文件将 artifactId 指定为*:*:*:*

<filters>
    <filter>
        <artifact>*:*:*:*</artifact>
        <excludes>
            <exclude>*.RSA</exclude>
        </excludes>
    </filter>
</filters>

答案 2

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

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

推荐