zoukankan      html  css  js  c++  java
  • lombok的问题,Failed to execute goal org.apache.maven.plugins:mavencompilerplugin

    最近公司新项目,需要将原本的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升级有风险,慎用

    欢迎大家留言,以便于后面的人更快解决问题!另外亦欢迎大家可以关注我的微信公众号,方便利用零碎时间互相交流。共勉!

    ------愿来生只做陌上的看花人,无须入尘缘,仅行于陌上,看一川风花,无爱无伤-----
  • 相关阅读:
    POJ 2031 Building a Space Station
    [Codeforces 623A] Graph and String
    [Codeforces 986E] Prince's Problem
    [Codeforces 496E] Distributing Parts
    [Codeforces 1037E] Trip
    [Codeforces 1037D] Valid BFS?
    [Codeforces 666B] World Tour
    [Codeforces 449B] Jzzhu and Cities
    [Codeforces 475B] Strongly Connected City
    [Codeforces 437C] The Child and Toy
  • 原文地址:https://www.cnblogs.com/caozz/p/15527782.html
Copyright © 2011-2022 走看看