in most cases this is enough:
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
if you have declared custom Gradle tasks like integrationTest
for example, add a configuration for compile<YourTaskName>Kotlin
as well:
compileIntegrationTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}