Slackbot
12/30/2022, 9:16 AMMartin
12/30/2022, 10:05 AMjvmToolchain
downloads a JDK 17 if none is installed on your machine
⢠jvmTarget
will only set the target so if you only have JDK 11 locally, it will most likely failMartin
12/30/2022, 10:08 AMjvmToolchain
personally, it makes it easier to onboard new contributorsPierre Ayfri
12/30/2022, 10:10 AMJavi
12/30/2022, 11:47 AMkotlinOptions.jvmTarget
That is going to do nothing in 1.8.0 if I remember correctly.
But you don't need to have the specific version installed. For example if you have Java 18 and you don't set a jvmTarget
, the artifacts will be compatible with Java 18+. If you set 11, even compiling with Java 18, it produces artifacts compatible with Java 11.
But it is better to move to jvmToolchain
Pierre Ayfri
12/30/2022, 11:55 AMjvmTarget
if I understand correctly. And prior to this it was somewhat usefulEli Graber
12/30/2022, 12:35 PMjvmToolchain
accordingly, but you want your code to compile to Java 11 bytecode, and so you'd set jvmTarget
to 11.Javi
12/30/2022, 12:54 PMJavi
12/30/2022, 12:55 PMJavi
12/30/2022, 12:56 PMlanguageVersion
in the toolchainTapchicoma
12/30/2022, 12:58 PMjvmTarget
. With Kotlin 1.8.0 there is no difference - both approaches should do the same and also configure jvmTarget
Tapchicoma
01/02/2023, 1:54 PMkotlin.jvmToolchain
also configures -jdk-home
Kotlin compiler argument. This arguments configures which JDK classes will be used in the compilation classpath. My message above was more about java.toolchain { ... }
vs kotlin.jvmToolchain { .. }
DSL.Javi
01/02/2023, 2:15 PMMartin
01/02/2023, 2:16 PMMartin
01/02/2023, 2:18 PMJavi
01/02/2023, 2:19 PMMartin
01/02/2023, 2:20 PMJAVA_HOME
in your IntelliJ settingsMartin
01/02/2023, 2:21 PMMartin
01/02/2023, 2:22 PMthe project structure jdk is irrelevant thenI think it might still be used for autocomplete in some files, not sure which ones
Martin
01/02/2023, 2:22 PMMartin
01/02/2023, 2:23 PMJAVA_HOME
is working quite well for meTapchicoma
01/02/2023, 2:26 PMthe project structure jdk is irrelevant thenGenerally no as build cache for build scripts relies on JDK version. But could be workaround via convention plugins + Gradle 8+ š
Martin
01/02/2023, 2:26 PMGenerally no as build cache for build scripts relies on JDK versionIsn't that JDK taken from JAVA_HOME (and not project structure)?
Martin
01/02/2023, 2:27 PMTapchicoma
01/02/2023, 2:28 PMMartin
01/02/2023, 2:28 PMMartin
01/02/2023, 2:29 PMMartin
01/02/2023, 2:30 PM