1 min readAug 11, 2018
Both compileKotlin and compileTestKotlin are Gradle tasks that exist when the kotlin plugin is applied. Although both tasks are similar they are isolated from each other. However since the same value (for jvmTarget) is used for both tasks a constant can be defined and referred to instead, eg:
val newJvmTarget = "1.8"
// ...
val compileKotlin by tasks.getting(KotlinCompile::class) {
// ...
kotlinOptions {
// ...
jvmTarget = newJvmTarget
}
}
// ...