Open DJViking opened 3 years ago
I think that your workaround is the proper solution.
Using
tasks.withType(RuntimeTask).configureEach {
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(16)
vendor = JvmVendorSpec.ADOPTOPENJDK
}
}
doesn't work because javaCompiler
is a property of JavaCompile
and RuntimeTask
doesn't extend JavaCompile
.
If you want to build with Java 11, and use jpackage, prior to Java Toolchain support in Gradle, you had to specify
jpackageHome
with a newer version of Java that has thejpackage
tool.jpackageHome = '/usr/java/jdk-16'
With Toolchain support in gradle, you can specify a different Toolchain for a single Gradle task. https://docs.gradle.org/current/userguide/toolchains.html#specify_custom_toolchains_for_individual_tasks
This plugin has support now for Toolchain, but to specify a different than the main toolchain does not seem possible. Otherwise something like this would be possible:
Though there is a workaround. If not perhaps the proper solution?