[英]How to exclude META-INF files from bundle?
使用Maven Apache Felix插件构建捆绑的jar时,如何排除一些META-INF文件?
这是我的felix配置
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<!-- Embed all dependencies -->
<Embed-Transitive>true</Embed-Transitive>
<Embed-Dependency>*;scope=compile|runtime;inline=true</Embed-Dependency>
</instructions>
</configuration>
</plugin>
我提取所有可传递依赖项并将其嵌入,因为我想创建一个可以添加到类路径中的jar。
当我尝试运行jar时,出现异常
Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
在SO上找到一个帖子之后,我手动删除了一些似乎来自弹性文件的META-INF /文件。 然后,我重新创建了我的jar文件,它起作用了。 有没有办法使用felix插件自动执行此操作?
谢谢
看起来shadow插件使此操作变得容易。 所以我改用了shade插件,而不是felix插件。 这是我的pom插件配置:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<!-- We need to exclude the signatures for any signed jars otherwise
we get an exception. -->
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.