https://stackoverflow.com/a/57592130
Run this command: Thin jar made executable via maven-jar-plugin. Check pom.xml for more details.
java -jar test-1.0-SNAPSHOT.jar
And get:
Exception in thread "main" java.lang.NoClassDefFoundError: org/joda/time/LocalDateTime
at org.example.Main.main(Main.java:8)
Caused by: java.lang.ClassNotFoundException: org.joda.time.LocalDateTime
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 1 more
Because thin jar has no jodatime dependency inside.
java -cp 'test-1.0-SNAPSHOT.jar:libs/*' org.example.Main
Fat jar is compiled via maven-assembly-plugin. Check pom.xml for more details.
java -jar test-1.0-SNAPSHOT-jar-with-dependencies.jar