故障安全错误:“清单主要属性的签名文件摘要无效";使用阴影插件时 [英] Failsafe error: "Invalid signature file digest for Manifest main attributes" when using shade plugin

查看:168
本文介绍了故障安全错误:“清单主要属性的签名文件摘要无效";使用阴影插件时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在maven中使用shade-plugin并稍后尝试使用failsafe-plugin运行集成测试时,在将要运行failsafe时出现以下错误,导致跳过了集成测试:

When using shade-plugin in maven and later trying to run integration tests using failsafe-plugin, I get the following error when failsafe is about to run, resulting in my integration tests being skipped:

[ERROR] Invalid signature file digest for Manifest main attributes

此错误似乎是由依赖项中的签名jar引起的. 此答案建议使用依赖插件来过滤签名,但它似乎对我不起作用.阴影插件只是解压缩了所有依赖关系,并没有解决问题.我该如何进行这项工作?

This error seems to be caused by signed jars in dependencies. This answer suggests using dependency plugin to filter out the signatures, but it did not seem to work for me. Shade-plugin just unpacked all the dependencies and did not solve the problem. How can I make this work?

推荐答案

过滤掉签名似乎是正确的方法,但是可以(也许应该)直接在阴影插件中完成,而无需任何其他插件.这是隐式记录在shade-plugins网站上的,其中讨论了工件过滤器.我确保我的阴影插件执行包括以下过滤器,并且可以正常工作:

Filtering out the signatures seems to be the right approach, but can (and perhaps should) be done directly in shade-plugin, without needing any other plugins. This is implicitly documented on shade-plugins website, where it talks about artifact filters. I made sure my shade-plugin execution included the following filters, and it worked:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-shade-plugin</artifactId>
  <version>3.2.0</version>
  <configuration>
    <createDependencyReducedPom>false</createDependencyReducedPom>
  </configuration>
  <executions>
    <execution>
      <phase>package</phase>
      <goals>
        <goal>shade</goal>
      </goals>
      <configuration>
        <filters>
          <filter>
            <artifact>*:*</artifact>
            <excludes>
              <exclude>META-INF/*.SF</exclude>
              <exclude>META-INF/*.DSA</exclude>
              <exclude>META-INF/*.RSA</exclude>
            </excludes>
          </filter>
        </filters>
      </configuration>
    </execution>
  </executions>
</plugin>

这篇关于故障安全错误:“清单主要属性的签名文件摘要无效";使用阴影插件时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆