Slackbot
02/19/2024, 11:28 AMThomas Broyer
02/19/2024, 11:36 AMcompilerArgs
, and add the add-opens and add-exports from https://errorprone.info/docs/installation (or https://github.com/google/error-prone/blob/ae3a19f44e173847d5e01bc95fd0b1d74a41d6b6/pom.xml#L235-L257) to the jvmArgs
of your test and exec tasks.Thomas Broyer
02/19/2024, 11:39 AMcompilerArgs
at least); for instance, the custom check I use in the gradle-errorprone-plugin integration tests has a much smaller list: https://github.com/tbroyer/gradle-errorprone-plugin/blob/5d9e2a80d37fcdb393ff694f1[…]n/net/ltgt/gradle/errorprone/ErrorPronePluginIntegrationTest.ktMatan Sabag
02/19/2024, 11:53 AMerror: exporting a package from system module jdk.compiler is not allowed with --releaseI have a pretty standard build configuration, is there anything else I shoudl modify?
Thomas Broyer
02/19/2024, 12:17 PMrelease
) to define Java compatibility.Vampire
02/19/2024, 1:15 PMrelease
if not explicitly setting it?
I'd assumed that due to the proper toolchain being used already, release
should not be necessary.Matan Sabag
02/19/2024, 5:21 PMJavaPluginExtension javaExt = (JavaPluginExtension) project.getExtensions().getByName("java");
javaExt.getToolchain().getLanguageVersion().set(JavaLanguageVersion.of(11));
Vampire
02/19/2024, 5:36 PMtasks.compileJava { options.release.set(provider { null }) }
😞
You can only override it to something else.
So it indeed seems to be not possible to use something that is incompatible with --release
with toolchains, except with some trickery like
tasks.compileJava {
javaCompiler.set(provider { null })
options.forkOptions.javaHome = javaToolchains.compilerFor(java.toolchain).get().metadata.installationPath.asFile
}
Matan Sabag
02/20/2024, 7:22 AMVampire
02/20/2024, 8:01 AM-release
being the problem, I would probably use what I posted last + defining compatibility on the task. Then other tasks can continue using the defined toolchain and also the computer task is using the toolchain, just in a custom way, so you preserve the separation of Java to run Gradle and the Java to build your project.
It might also be worth submitting a bug or feature request for being able to not use -release
with normal toolchain usage, as you have a valid use-case for it.