Hey devs, so I got a problem with creating a fat j...
# server
s
Hey devs, so I got a problem with creating a fat jar in my project since we I converted the Gradle config from GroovyDSL to KotlinDSL. We used to use the shadowJar plugin, but according to what I googled so far, there should even be a solution without it. So I converted (with the help of Stackoverflow) the Groovy solution (of how to configure the jar-plugin). But
gradle clean build
still doesn't create a fat jar (but at least the main-class is set). Here is the Stackoverflow ticket: https://stackoverflow.com/questions/55575264/creating-a-fat-jar-in-gradle-with-kotlindsl
m
Is suggest asking in #gradle. Or look at gradle docs under publishing. I seem to recall info there about fat jars. Can't do everything shadow plugin can, but likely what you need.
👍 1
s
sounds reasonable 😅 but how do I contact the workspace admin in order to receive an invitation?
m
All channels are open, and you should be able to search/navigate channels to get there. cmd/ctrl-K is keyboard shortcut for navigating to, and searching for channels.
https://docs.gradle.org/current/userguide/building_java_projects.html#sec:java_packaging I thought there was more customization available, but can’t find it at moment. If all you want is the dependent jars, then they give an example under Example 7.
n
Highly recommend using the Shadow plugin ( https://imperceptiblethoughts.com/shadow/ ) to create a Fat JAR. The plugin works well with Kotlin DSL.
Example build file for creating a Fat JAR via the Shadow plugin.
s
@Mike ah, you meant the kotlin.slack channel which i totally overlooked. I thought you meant the gradle.slack workspace 😂
@napperley Hi Nick, i'm fine with using shadowJar. That's how I started of actually. It failed to work after switching but now I'll check out your config. Thanks!
d
If all you need is to make a docker image out of it, google's jib is VERY easy to configure, just keep its plugin on top of all the others in the plugin block.