IDEA 2019.3 +JDK11 +lombok1.16不生效

今天在使用JDK11时,出现lombok提示不生效的问题 报错原因如下:

Warning:(7, 8) java: lombok.javac.apt.LombokProcessor could not be initialized. Lombok will not run during this compilation: java.lang.IllegalArgumentException: com.sun.proxy.$Proxy25 extends java.lang.reflect.Proxy implements javax.tools.StandardJavaFileManager
  	at lombok.javac.apt.LombokFileObjects.getCompiler(LombokFileObjects.java:148)
  	at lombok.javac.apt.InterceptingJavaFileManager.(InterceptingJavaFileManager.java:40)
  	at lombok.javac.apt.LombokProcessor.placePostCompileAndDontMakeForceRoundDummiesHook(LombokProcessor.java:165)
  	at lombok.javac.apt.LombokProcessor.init(LombokProcessor.java:87)
  	at lombok.core.AnnotationProcessor$JavacDescriptor.want(AnnotationProcessor.java:87)
  	at lombok.core.AnnotationProcessor.init(AnnotationProcessor.java:140)
  	at lombok.launch.AnnotationProcessorHider$AnnotationProcessor.init(AnnotationProcessor.java:69)
  	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$ProcessorState.(JavacProcessingEnvironment.java:678)
  	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$DiscoveredProcessors$ProcessorStateIterator.next(JavacProcessingEnvironment.java:778)
  	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:873)
  	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1214)
  	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1326)
  	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1258)
  	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:936)
  	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
  	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
  	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
  	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
  	at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:207)
  	at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:486)
  	at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:338)
  	at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:263)
  	at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:216)
  	at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1328)
  	at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1006)
  	at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1073)
  	at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:967)
  	at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:796)
  	at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:378)
  	at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:178)
  	at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:140)
  	at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:297)
  	at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:130)
  	at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:232)
  	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
  	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
  	at java.base/java.lang.Thread.run(Thread.java:834)

 我尝试过一下解决方案:

1.idea的简单,在file——settings——build——compiler——Annotation Processors 找到下面框红的地方。

https://blog.csdn.net/ww130929/article/details/86917331

以上方法对我出现这个问题无效!

经过多方排查,问题出现原因是版本问题,目前貌似1.16有的版本有问题,我使用的是1.16.20。

将lombok修改为最新版本即可。

maven中心仓库地址:

https://mvnrepository.com/artifact/org.projectlombok/lombok

        
            org.projectlombok
            lombok
            1.18.0
        

说明:CSDN复制的情况太严重了,请各位同僚,不要随意复制。上百度一搜,千篇一律的太多了,浪费时间和精力。扪心自问一下,您复制了又有什么用呢?您自己真的知道怎么解决了吗?下次出现一样的问题,是否又是拿起百度重新搜一下?

你可能感兴趣的:(java框架篇,java)