Question Maven 3.5 with JDK 9

I am using Maven 3.5.0 and JDK 9 build 171. When I tried to compile my project, I got an exception:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) on project admin: Fatal error compiling: ja-va.lang.NoClassDefFoundError: com/sun/tools/javac/file/BaseFileObject: com.sun.tools.javac.file.BaseFileObject 

I added flags to MAVEN_OPTS, but without success:

 --add-opens jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED 

Any suggestions?

+5
source share
2 answers

My project was dependent on the Lombok library. Updating pom.xml to version 1.16.18 allowed to complete the assembly with warnings:

 WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by lombok.javac.apt.LombokProcessor to field com.sun.tools.javac.processing.JavacProcessingEnvironment.discoveredProcs WARNING: Please consider reporting this to the maintainers of lombok.javac.apt.LombokProcessor WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release 
+4
source

Maven compiler plugin in version 3.6.1 is not suitable. You must use a version of at least 3.6.2.

+1
source

Source: https://habr.com/ru/post/1268587/


All Articles