Including Signed Libraries in Executable JAR with

2019-08-16 11:52发布

问题:

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?

回答1:

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