I’m using com.github.johnrengelman.shadow for create ShadowJar.
My expectation is that, inside my generated jar file, there are all library with jar format.
Let say, inside my jar, there are “commons-io.jar, common-lang.jar…” instead of the .class files copied from .jar file.
I can’t find any help from the document of johnrengelman.shadow plugin.
How to do it with this plugin, or do you have any other plugin can do that?
I’m using JDK 1.8
No, the Shadow plugin afaik cannot do that.
It can only build those bad-practice fat jars that copy together the contents and ship around some of the quirks you can see with such fat jars, but not all.
If you build a Spring Boot jar, the dependencies are included in the jar as literal jars and a special class loader then loads the classes from there.
But actually I’d just use the
application plugin and build a proper distributable archive instead of a fat jar. I personally do not see any advantage of fat jars, even if built properly like the Spring Boot jars.