If anyone interested boilerplate Kotlin Project us...
# getting-started
j
If anyone interested boilerplate Kotlin Project using Gradle you can use this https://github.com/jasoet/kotlin-gradle-boilerplate Update to Kotlin 1.3.0
n
how about using .gradle.kts there ? it would deduplicate the amount of repition for versions of dependencies and plugins
👍 1
m
Sorry, but I don’t think it will. The new
plugins
block does not support variables regardless of whether it’s Kotlin or Groovy. Has to do with internal optimizations of the build system. The Gradle team is investigating how to achieve both the build speed, AND supporting variables in the plugins block.
n
it does when the variables are coming from buildSrc
m
Hmm, interesting. I wonder if Groovy does that too. Most likely it will. Still feels like a lot of extra code to me just to avoid a bit of duplication. Looking at @jasoet’s build.gradle more closely, I think the ext.kotlinVersion can be removed as it’s not used anywhere. That leaves the duplication in the plugins block for kotlin.jvm and kotlin.kapt. For me, that would be fine, but we all have our preferences.
n
at least once you have multiple modules having the versions and possibly dependency coordinates defined in buildSrc becomes a lot more viable
m
Although not possible for plugins, for other dependencies, I tend to rely on dependency management. That way all the projects I’m working on use the same dependencies. Different needs for different projects. But thank you for showing me an alternate way to identify versions in a build script.
j
I am waiting to Gradle 5, then after that I will move to kts. kotlinVersion only used on buildscripts dependency and as far as I know we cannot use variable for defining plugin version yet
👍 1