Maven Shade Plugin That's convenient. You can start the program with a single jar file without writing a lengthy classpath.
It happened when I tried to put the JDBC driver of Microsoft SQL Server in such a jar file.
When I ran it, it failed with this error.
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes 
People with the same problem → https://social.msdn.microsoft.com/Forums/sqlserver/en-US/f5c69fee-8c68-4601-bfcb-376e21dfa809/sql-server-jdbc-javalangsecurityexception-invalid-signature-file- digest? forum = sqldataaccess
Is it because the signature is in sqljdbc4.jar? ↑ I don't understand at all.
Do not include the signature file (?) Included in sqljdbc4.jar in the final jar.
pom.xml
(snip)
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
(snip)
                <configuration>
                    <filters>
                        <filter>
                            <artifact>*:*</artifact>
                            <excludes>
                                <exclude>META-INF/*.SF</exclude>
                                <exclude>META-INF/*.DSA</exclude>
                                <exclude>META-INF/*.RSA</exclude>
                            </excludes>
                        </filter>
(snip)
You have to understand how Java handles and executes jar files. .. ..
Recommended Posts