Sourabh Rawat
02/19/2020, 8:41 AMbootJar
and shadowJar
. Can I use shadowJar
for Spring boot applications?Sourabh Rawat
02/19/2020, 8:46 AMdiesieben07
02/19/2020, 8:48 AMshadowJar
I assume you refer to this plugin: https://github.com/johnrengelman/shadow?
That plugin copies all the dependencies and your code into one fat jar file (with only classes inside). It can rewrite package names as well while it does so.
Spring boot on the other hand generates a jar file with all your classes inside BOOT-INF/classes
and all your dependencies as jar files (jar file inside jar file) in BOOT-INF/lib
. It then has a main class, which sets up a class loader to load these contained files and dependencies and then invokes your actual main class. You can't simply use a boot-jar file as a dependency for another project, which you could do with a shadow jar. The boot jar is only meant to create a single runnable jar file. Shadow also achieves that, but boot does it in a more compatible way (dependency jar files are kept as-is)diesieben07
02/19/2020, 8:51 AMSourabh Rawat
02/19/2020, 8:52 AMSourabh Rawat
02/19/2020, 8:55 AMdiesieben07
02/19/2020, 9:04 AMSourabh Rawat
02/19/2020, 9:07 AMMike
02/19/2020, 3:15 PM