Thank you for the suggestion. Yes, it worked however I got another error when compiling the project:
java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in unnamed module @0x277818a4) cannot access class com.sun.tools.javac.util.Context (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.util to unnamed module @0x277818a4
I tried the following JAVA_JDK_OPTIONS: --permit-illegal-access -Djdk.attach.allowAttachSelf=true --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
However Gradle still complains about compilation error. Can you please advise?
First of all, Gradle doesn’t run on Java 9 yet. I guess you’ve seen it, but to be clear, it means that you need to run Gradle using on JDK 8, then fork compilation and testing to use Java 9.
As such, I think your compileJava task should be configured to something like this:
JDK_JAVA_OPTIONS is used to pass options to java.
JDK_JAVAC_OPTIONS is used to pass options to javac (starting in b157).
So rather than cluttering your gradle code with JDK9 stuff, you might want to use this environment variable.
My recommendation is to hide JDK9 options required only for the gradle build in the gradle script.
Starting in Jake b172, the --add-opens are no longer required. Also --permit-illegal-access goes away and the new–illegal-access=permit is the default.
Hopefully that will migrate into JDK9 in the near future.
Thank you for detailed explanation. I just tested my project on the latest build b173 and it seems that --illegal-access is not supported yet(I got unrecognized flag error when starting my build) .
–permit-illegal-access flag works fine and replaces all those --add-open stuff.