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

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

 

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

上一篇:(MAC)selenium python运行时报错ImportError: Start directory is not importable: '/Users/may/Documents/automatortest/frame_mp\\src\\test_case'


下一篇:ubuntu20开启root登录ssh