https://kotlinlang.org logo
Title
d

davidasync

12/13/2018, 2:53 PM
Hello, Anyone know benefit using shadowJar rather than using gradle application plugin to create single executable jar?
r

r4zzz4k

12/13/2018, 3:21 PM
Gradle
application
plugin generates jars which contain only current module stuff. To run the app you still need to provide all the dependencies in claasspath. Shadow, on the other hand, generates so called fat jar, which contains both app classes and all the dependencies and can be run as is without setting up environment.
d

davidasync

12/13/2018, 3:36 PM
i see thank u
g

gildor

12/14/2018, 1:25 AM
To run the app you still need to provide all the dependencies in claasspath.
Not like that, application creates executable jar and all required dependencies as separate jars and a script that runs it and configures classpath
a

aarjav

12/14/2018, 2:24 PM
Unfortunately I've run into a problem on Windows 8 using application plug-in. It was cmd was too long due to explicit jar names as arguments to java -cp. Work around is a semi manual step. Either customize the plugin to generate a different bat file or edit it after it is generated. For my project the 'fat' jat was 'only' 50 mb so I went with that solution. Ran into this 3-4 months back, maybe it's fixed by now. Not sure
g

gildor

12/14/2018, 3:16 PM
Fat jar imo is good solution