Skip to content

Commit

Permalink
Use newer way of configuring the Kotlin compiler in Gradle
Browse files Browse the repository at this point in the history
Currently, the generated projects use:

```gradle
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
    kotlinOptions.jvmTarget = JavaVersion.VERSION_21.toString()
    kotlinOptions.javaParameters = true
}
```

however org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions
(the type of kotlinOptions) has been deprecated and the
new way to configure stuff is described in:
https://kotlinlang.org/docs/gradle-compiler-options.html
  • Loading branch information
geoand committed Oct 16, 2024
1 parent fe164e0 commit 83ae0ca
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
8 changes: 5 additions & 3 deletions docs/src/main/asciidoc/kotlin.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,11 @@ allOpen { // <2>
annotation("io.quarkus.test.junit.QuarkusTest")
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = JavaVersion.VERSION_11.toString()
kotlinOptions.javaParameters = true
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_21
javaParameters = true
}
}
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ allOpen {
annotation("io.quarkus.test.junit.QuarkusTest")
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = JavaVersion.VERSION_{java.version}.toString()
kotlinOptions.javaParameters = true
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_21
javaParameters = true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ allOpen {
annotation("io.quarkus.test.junit.QuarkusTest")
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = JavaVersion.VERSION_17.toString()
kotlinOptions.javaParameters = true
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_21
javaParameters = true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ allOpen {
annotation("io.quarkus.test.junit.QuarkusTest")
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = JavaVersion.VERSION_17.toString()
kotlinOptions.javaParameters = true
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_21
javaParameters = true
}
}

0 comments on commit 83ae0ca

Please sign in to comment.