Use maven-shade-plugin to package the runnable jar, but because the bouncycastle related jar is referenced, an exception "java.lang.SecurityException: no manifest section for signature file entry" occurs after the packaged jar is run.
After google for a long time, I found that due to the jar related to bouncycastle, the general maven-shad-plugin configuration is not available. It needs to be modified and added as follows:
<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>
Original from:
http://www.jamesswafford.com/2012/03/11/java-lang-securityexception-no-manifest-section-for-signature-file-entry/