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)加一个依赖
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
<scope>provided</scope>
</dependency>
(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升级有风险,慎用
欢迎大家留言,以便于后面的人更快解决问题!另外亦欢迎大家可以关注我的微信公众号,方便利用零碎时间互相交流。共勉!
标签:access,execute,goal,javac,illegal,maven,WARNING,lombok 来源: https://www.cnblogs.com/caozz/p/15527782.html