【问题标题】:Failsafe error: "Invalid signature file digest for Manifest main attributes" when using shade plugin故障安全错误:使用阴影插件时“清单主要属性的签名文件摘要无效”
【发布时间】:2021-01-11 18:06:41
【问题描述】:

当在 maven 中使用 shade-plugin 并尝试使用 failsafe-plugin 运行集成测试时,当故障安全即将运行时,我收到以下错误,导致我的集成测试被跳过:

[ERROR] Invalid signature file digest for Manifest main attributes

此错误似乎是由依赖项中的签名 jar 引起的。 This answer 建议使用依赖插件来过滤掉签名,但它似乎对我不起作用。 Shade-plugin 只是解压了所有的依赖,并没有解决问题。我怎样才能做到这一点?

【问题讨论】:

    标签: maven jar maven-shade-plugin maven-failsafe-plugin


    【解决方案1】:

    过滤掉签名似乎是正确的方法,但可以(也许应该)直接在 shade-plugin 中完成,而不需要任何其他插件。这是implicitly documented on shade-plugins website,它讨论了伪影过滤器。我确保我的 shade-plugin 执行包括以下过滤器,并且它有效:

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

    【讨论】:

    • 这和你原来的有什么不同?
    • 凭记忆,我尝试在 POM 中进行过滤(请原谅缺乏细节,已经过了一段时间)
    猜你喜欢
    • 2021-06-15
    • 1970-01-01
    • 2022-06-30
    • 2019-03-03
    • 2021-05-17
    • 2018-10-05
    • 2019-12-18
    • 2015-11-14
    • 1970-01-01
    相关资源
    最近更新 更多