How to use ErrorProne 2.33.0 with Gradle toolchains #107
Replies: 3 comments 3 replies
-
I think I found the solution. java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
} and set tasks.withType<JavaCompile> {
options.release.set(11)
} I'm also using Groovy/Spock for tests and had to do this: tasks.withType<GroovyCompile> {
javaLauncher.set(javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(11))
})
} |
Beta Was this translation helpful? Give feedback.
-
What do you mean by "Error prone plugin is not working with this configuration"? Note that by using a JDK 11 toolchain, you need to use a version of Error Prone that's compatible with JDK 11, so at most 2.31.0 (as 2.32.0 started requiring JDK 17). BTW, some would argue that the "preferred way" to target Java 11 is to use |
Beta Was this translation helpful? Give feedback.
-
What about adding example with |
Beta Was this translation helpful? Give feedback.
-
My default JDK is 17, but in my Gradle build I'm using toolchains, and set it to Java 11.
My configuration looks like this:
Gradle toolchains seems to be preferred way for building projects with different Java versions.
Error prone plugin is not working with this configuration.
Is is possible to use toolchains with Java version lower than 17?
If yes, please provide an example.
Beta Was this translation helpful? Give feedback.
All reactions