lombok的问题,Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin

最近公司新项目,需要将原本的springcloud项目由jdk8升级到jdk11,但是用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 

网上查了资料,基本都是说
(1)因为版本不对应导致,改一下版本
(2)加一个依赖

        
            javax.annotation
            javax.annotation-api
            1.3.2
            provided
        

(3)Eclipse的话因为把jdk配置成jre了

以上方法均不能解决我的问题,我就用命令执行了一下mvn install
看到有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

抱着试试看的心理,把代码中lombom的代码注释掉(依赖还在),重新打包,问题解决。

总结:还不太理解原理,但是使用lombok升级有风险,慎用

你可能感兴趣的:(lombok的问题,Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin)