Tag Archives: lombok Error

[Solved] lombok Error: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin

The company needs to upgrade the original spring cloud project from jdk8 to jdk11 for new projects recently, but errors are always reported when packaging with Maven:

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project cloud-api-commons: Fatal error compiling: java.lang.ExceptionInInitializerError: com.sun.tools.javac.code.TypeTag
s 

I checked the information on the Internet and basically said

(1) Because the version does not correspond, change the version

(2) Add a dependency

        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <version>1.3.2</version>
            <scope>provided</scope>
        </dependency>

(3) Eclipse, because the JDK is configured as JRE

None of the above methods can solve my problem, so I executed MVN install
with the command

See the alarm information of Lombok

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

With a try mentality, comment out the lombom code in the code (the dependency is still there), repackage and solve the problem.

Summary: I don’t quite understand the principle, but there are risks in using Lombok upgrade. Use it with caution.