Maven Shade 插件不排除 META-INF.versions 文件

问题描述 投票:0回答:1

使用Maven Shade插件3.6.0

我有以下过滤器:

                    <filters>
                        <filter>
                            <artifact>*:*</artifact>
                            <excludes>
                                <exclude>module-info.class</exclude>
                                <exclude>META-INF/LICENSE</exclude>
                                <exclude>META-INF/NOTICE</exclude>
                                <exclude>META-INF/MANIFEST.MF</exclude>
                                <exclude>META-INF.versions.9.module-info</exclude>
                            </excludes>
                        </filter>
                    </filters>

但是,我仍然看到以下警告:

classgraph-4.8.160.jar、jackson-core-2.17.0.jar、jackson-databind-2.15.2.jar、jackson-datatype-jdk8-2.15.2.jar、jackson-datatype-jsr310-2.15.2 .jar,jackson-module-parameter-names-2.15.2.jar 定义 1 个重叠类: [警告] - META-INF.versions.9.module-info

这是良性的,但如果可能的话我仍然想消除警告。我做错了什么?

maven maven-shade-plugin
1个回答
0
投票

使用的过滤器使用错误。

 <filters>
   <filter>
     <artifact>*:*</artifact>
     <excludes>
       <exclude>module-info.class</exclude>
       <exclude>META-INF/LICENSE</exclude>
       <exclude>META-INF/NOTICE</exclude>
       <exclude>META-INF/MANIFEST.MF</exclude>
       <exclude>META-INF/versions/9/module-info.class</exclude>
     </excludes>
   </filter>
 </filters>

或者排除多版本 jar 的所有类型的

module-info.class
文件:

 <filters>
   <filter>
     <artifact>*:*</artifact>
     <excludes>
       <exclude>module-info.class</exclude>
       <exclude>META-INF/LICENSE</exclude>
       <exclude>META-INF/NOTICE</exclude>
       <exclude>META-INF/MANIFEST.MF</exclude>
       <exclude>META-INF/versions/**/module-info.class</exclude>
     </excludes>
   </filter>
 </filters>
© www.soinside.com 2019 - 2024. All rights reserved.