Using Gradle 6.8.3.
I’m defining my toolchain in my build.gradle:
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}
Gradle, instead, is running with Java 11. Problem is that, even if I run Gradle passing -Xmx1g to it, it seems not to pass this JVM arg to the Java 8 compiler when it compiles my project. Since compiling this project fails due to OutOfMemoryError if I do not increase the heap space, I can’t build my project.
So, question is: how to make Gradle pass the -Xmx1g parameter to the forked JVM specified as a toolchain it uses to compile my project?