Maven shade jar throw exception
The problem is because of java version. I didn't notice that my new ide automatically use ibm's java, when I change the jre to sun's java ,it works well:)
The SecurityException
comes up because one of your dependencies is a signed jar.
As the shade plugin is repacking this jar, it gets invalid. -> SecurityException
at launch
To solve the problem, you have to unsign the dependency jars while repacking them. This can be done by simply not repacking the files that make the jar signed, using a filter:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>stand-alone</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>stand-alone</shadedClassifierName>
<filters>
<filter>
<!--
Exclude files that sign a jar
(one or multiple of the dependencies).
One may not repack a signed jar without
this, or you will get a
SecurityException at program start.
-->
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/*.INF</exclude> <!-- This one may not be required -->
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
This solution was extracted from here: https://issues.apache.org/jira/browse/MSHADE-61