Failsafe error: “Invalid signature file digest for Manifest main attributes” when using shade plugin

房东的猫 提交于 2021-01-29 01:33:09

问题


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

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?


回答1:


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>


来源:https://stackoverflow.com/questions/64063528/failsafe-error-invalid-signature-file-digest-for-manifest-main-attributes-whe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!