When attempting to compile a project on which maven is running Java 16, the error message java.lang.IllegalAccessError: class javaoo.javac8.OOProcessor (in unnamed module @0x3a175162) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module @0x3a175162 appears. This happens regardless of the properties of the Maven compiler plugin, as setting the "source" and "target" tags to 1.8 has no effect. However, changing JAVA_HOME to use JDK 1.8 instead of using JDK 16 results in a successful compilation.
When attempting to compile a project on which maven is running Java 16, the error message
java.lang.IllegalAccessError: class javaoo.javac8.OOProcessor (in unnamed module @0x3a175162) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module @0x3a175162
appears. This happens regardless of the properties of the Maven compiler plugin, as setting the "source" and "target" tags to1.8
has no effect. However, changingJAVA_HOME
to use JDK 1.8 instead of using JDK 16 results in a successful compilation.