Create a dependency folder with dependent banks with the Maven Shade plugin

I am creating a thick jar using the maven shade plugin, which also includes some banana castle jars. But this poses a problem due to the unsigned version of Bouncy Castle.

java.lang.SecurityException: JCE cannot authenticate BC provider

Now one solution is to have an external dependency folder and define this path in the manifest file with the fat jar.

For instance:

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.4.3</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                            <artifactSet>
                                <excludes>
                                    <exclude>org.bouncycastle:*:*:*</exclude>
                                </excludes>
                            </artifactSet>
                        <finalName>Relay-S3-Monitor-jar-with-dependencies</finalName>
                        <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>at.seresunit.lecturemanager_connector.App</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>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                 <manifestEntries>
                                    <Main-Class>com.pb.relay.s3.CamelBoot</Main-Class>
                                    <Class-Path>. bouncycastle_libs/bcpg-jdk15on-1.55.jar bouncycastle_libs/bcprov-jdk15on-1.55.jar bouncycastle_libs/bcprov-jdk16-1.45.jar</Class-Path>
                                </manifestEntries>
                            </transformer>
                        </transformers>
                    </configuration>
                </execution>
            </executions>
        </plugin

Now what I need: in the same pom.xml, I need to insert a section (plugin) that creates a folder with folders (only with an inflatable jar)

+4
source share
2 answers

uber jar, BouncyCastle:

Exception in thread "main" java.security.NoSuchProviderException: JCE cannot authenticate the provider BC

, , , , , Maven shade jar, ( ).

maven plugin solution, jar-in-jar, JCE .

+1

Source: https://habr.com/ru/post/1673954/


All Articles