使用Maven在可执行JAR中包含签名库

使用Maven在可执行JAR中包含签名库

本文介绍了使用Maven在可执行JAR中包含签名库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Maven shade assembly 插件首先解压缩,然后将依赖项添加到可执行jar。这可能会与Java Cryptography Extension产生冲突,因为像BouncyCastle这样的库应该在它们的签名版本中使用。


问题:有没有办法用maven创建可执行jar,其方式是包含库而不解包?

Maven shade and assembly plugins first unpack and then add dependencies to the executable jar. This can produce a conflict with Java Cryptography Extension, since the libraries like BouncyCastle should be used in their signed versions.

Question: Is there a way to create executable jar with maven in a way that the libraries are included without unpacking?

推荐答案

标准类加载器不会从另一个jar加载类,因此爆炸的jar。实现添加签名jar的最佳方法是使用-cp命令,如:

The standard classloader will not load classes from another jar, hence the exploded jar. The best way to achieve adding the signed jars is using the -cp command, something like :

java -cp signedjar;shadepluginjar Main

这篇关于使用Maven在可执行JAR中包含签名库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-03 19:17