封装jar问题java.lang.SecurityException: Invalid signature file digest for Manifest main attributes以及maven依赖重提解决

1、jar包封装完成后,其他项目引用jar,启动时报错java.lang.SecurityException: Invalid signature file digest for Manifest main attributes

这是因为jar中MATE-INF目录下存在*.SF,*.DSA,*.RSA文件,这些文件中有签名导致错误,删除即可

推荐直接在打包的时候排除掉  pom如下:

<build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>3.3.0</version>
                    <configuration>
                        <!-- put your configurations here -->
                        <filters>
                            <filter>
                                <artifact>*:*</artifact>
                                <excludes>
                                    <exclude>META-INF/*.SF</exclude>
                                    <exclude>META-INF/*.DSA</exclude>
                                    <exclude>META-INF/*.RSA</exclude>
                                </excludes>
                            </filter>
                        </filters>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>shade</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
    </build>

  

2、maven依赖冲突

idea使用maven helper插件查看依赖冲突,https://plugins.jetbrains.com/plugin/7179-maven-helper

 

posted @ 2021-09-07 14:07  卯仙  阅读(455)  评论(0编辑  收藏  举报