https://kotlinlang.org logo
Title
b

breandan

01/01/2018, 6:00 PM
Not sure if this is an issue with the Kotlin plugin, or the Gradle Kotlin DSL, or something I'm doing wrong. Any ideas?
n

napperley

01/01/2018, 11:41 PM
Append the following to the build file:
val compileKotlin by tasks.getting(KotlinCompile::class) {
    kotlinOptions.jvmTarget = "1.8"
}
val compileTestKotlin by tasks.getting(KotlinCompile::class) {
    kotlinOptions.jvmTarget = "1.8"
}
Refresh Gradle in Intellij.
Works with Gradle 4.4 ☝️. Which version of Gradle are you using?
If all else fails try invalidating the Gradle build cache. In Intellij press Ctrl+Shift+a, enter in invalidate Gradle, select the first option, and click on the restart button.
b

breandan

01/02/2018, 12:09 AM
That worked, thanks! Did they change the task configuration syntax again? Seems pretty verbose. I'm using the
gradle-4.4-all
distribution.
i

ilya.gorbunov

01/02/2018, 3:18 AM
@breandan The way you originally configured kotlin options to target jvm 1.8 should be enough. If these options aren't imported in IDE properly, please report a bug.
b

breandan

01/02/2018, 5:44 PM
Think it was a stale cache, had to delete the
.idea
folder and
.iml
files and reimport the project from scratch. Thanks!