maven bouncycastle jar java.lang.SecurityException
程序员文章站
2022-07-13 10:36:52
...
用maven-shade-plugin 打包可运行jar,但因引用了bouncycastle 相关jar,打包出来的jar 运行后出现异常“java.lang.SecurityException: no manifest section for signature file entry”
网上google很久,才发现因bouncycastle相关的jar 原因,使用一般的maven-shad-plugin配置不可用,需修改新增如下:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>${maven.shade.plugin.version}</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <!-- because no manifest section for signature file entry --> <filters> <filter> <artifact>*:*</artifact> <excludes> <exclude>META-INF/*.SF</exclude> <exclude>META-INF/*.DSA</exclude> <exclude>META-INF/*.RSA</exclude> </excludes> </filter> </filters> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>com.csair.jar.Provider</mainClass> </transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> <resource>META-INF/spring.handlers</resource> </transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> <resource>META-INF/spring.schemas</resource> </transformer> </transformers> </configuration> </execution> </executions> </plugin> </plugins> </build>
原文来自:
http://www.jamesswafford.com/2012/03/11/java-lang-securityexception-no-manifest-section-for-signature-file-entry/
推荐阅读
-
Nexus-在项目中使用Maven私服,Deploy到私服、上传第三方jar包、在项目中使用私服jar包
-
maven下载jar包改用阿里云maven库的方法
-
maven项目从本地向本地仓库导入jar包
-
实测Maven上传jar包到私服的方法归纳
-
MyEclipse怎么修改Maven的Jar库地址?
-
解决Maven 编译出的jar中没有主清单属性
-
使用IDEA的maven工程导入ojdbc14 jar包失败
-
如何把JAR发布到maven*仓库的几种方法
-
Maven手动添加jar包到本地仓库
-
在eclipse中使用Maven分模块搭建SSM框架,创建jar、war、pom工程模块教学,项目的热部署,需要的可以留下邮箱,给大家发整理过的Maven笔记