https://kotlinlang.org logo
Title
g

gildor

11/14/2017, 6:46 AM
Why do not use shadow gradle plugin? https://github.com/johnrengelman/shadow
1
t

thewoolleyman

11/14/2017, 7:01 AM
I could use a third party plugin, but I can do it with a few lines anyway, and avoid the extra dependency. My question is primarily what is the recommended solution in the gradle kotlin dsl ecosystem, and why it doesn't seem to be supported as cleanly as in Groovy via the 'jar' task.
😕 1
g

gildor

11/14/2017, 7:08 AM
With shadow you need 0 lines of code and only one plugin in
plugins{}
block Gradle doesn’t have included tools to build fat/shadow jars, so you always have 2 choices: 1. Write an own task that provide solution good enough for you (for example if you need up-to-date checks to prevent useless rebuilds, you should write additional code) 2. Use a plugin that already implemented it
And not sure about “supported as cleanly as in Groovy” Could you show an example of code in groovy dsl?
n

napperley

11/14/2017, 8:04 AM
Shadow plugin works fine with Gradle Kotlin DSL. Plugin is compatible with Kotlin JVM & Kotlin JS based projects.
t

thewoolleyman

11/14/2017, 8:47 AM
OK, I'll give it a try, thanks for the clarifications. I'm new to the Gradle ecosystem (coming back to Java after 11 years), so I don't know all the tradeoffs or conventions, but I want to try to use Kotlin everywhere, including in build logic.
Hey, that worked great, it was just one line. Thanks for the help!