微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

MVN测试失败,出现SecurityException:清单主要属性的无效签名文件摘要scala spark项目

如何解决MVN测试失败,出现SecurityException:清单主要属性的无效签名文件摘要scala spark项目

mvn test失败

 [INFO]
    [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ project-name ---
    [INFO]
    [INFO] --- scalatest-maven-plugin:1.0:test (test) @ project-name ---
    discovery starting.
    *** RUN ABORTED ***
      java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
      at sun.security.util.SignatureFiLeverifier.processImpl(SignatureFiLeverifier.java:330)
      at sun.security.util.SignatureFiLeverifier.process(SignatureFiLeverifier.java:263)
      at java.util.jar.JarVerifier.processEntry(JarVerifier.java:318)
      at java.util.jar.JarVerifier.update(JarVerifier.java:230)
      at java.util.jar.JarFile.initializeVerifier(JarFile.java:383)
      at java.util.jar.JarFile.ensureInitialization(JarFile.java:617)
      at java.util.jar.JavaUtilJaraccessImpl.ensureInitialization(JavaUtilJaraccessImpl.java:69)
      at sun.misc.URLClasspath$JarLoader$2.getManifest(URLClasspath.java:991)
      at java.net.urlclassloader.defineClass(urlclassloader.java:451)
      at java.net.urlclassloader.access$100(urlclassloader.java:74)

我在sof和Apache邮件列表中搜索了很多答案,所有这些都是maven shade plugin的问题,人们在mvn软件包或mvn安装阶段都面临着问题。 但就我而言,我不使用maven shade插件,仅使用以下插件maven-scala-plugin,scalatest-maven-plugin。而且我只在“测试”阶段面临这个问题。

解决方法

最后发现了问题,该模块与具有阴影插件的模块存在依赖性,该模块的pom过滤如下解决了该问题:

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。