gpt4 book ai didi

maven - 在构建 maven 项目时获取 java.lang.ClassNotFoundException : lombok. javac.handlers.HandleHelper

转载 作者:行者123 更新时间:2023-12-01 11:10:37 34 4
gpt4 key购买 nike

使用 lombok 1.16.6 版本的 lombok。从命令行构建(mvn clean install)时,我收到此错误:

java.lang.ClassNotFoundException: lombok.javac.handlers.HandleHelper
[ERROR] at lombok.core.SpiLoadUtil$1$1.next(SpiLoadUtil.java:114)
[ERROR] at lombok.javac.HandlerLibrary.loadAnnotationHandlers(HandlerLibrary.java:170)
[ERROR] at lombok.javac.HandlerLibrary.load(HandlerLibrary.java:155)
[ERROR] at lombok.javac.JavacTransformer.<init>(JavacTransformer.java:43)
[ERROR] at lombok.javac.apt.Processor.init(Processor.java:86)
[ERROR] at lombok.core.AnnotationProcessor$JavacDescriptor.want(AnnotationProcessor.java:87)
[ERROR] at lombok.core.AnnotationProcessor.init(AnnotationProcessor.java:141)
[ERROR] at lombok.launch.AnnotationProcessorHider$AnnotationProcessor.init(AnnotationProcessor.java:53)
[ERROR] at com.sun.tools.javac.processing.JavacProcessingEnvironment$ProcessorState.<init>(JavacProcessingEnvironment.java:500)
[ERROR] at com.sun.tools.javac.processing.JavacProcessingEnvironment$DiscoveredProcessors$ProcessorStateIterator.next(JavacProcessingEnvironment.java:597)
[ERROR] at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:690)
[ERROR] at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
[ERROR] at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)
[ERROR] at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)
[ERROR] at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
[ERROR] at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)
[ERROR] at com.sun.tools.javac.main.Main.compile(Main.java:523)
[ERROR] at com.sun.tools.javac.main.Main.compile(Main.java:381)
[ERROR] at com.sun.tools.javac.main.Main.compile(Main.java:370)
[ERROR] at com.sun.tools.javac.main.Main.compile(Main.java:361)
[ERROR] at com.sun.tools.javac.Main.compile(Main.java:56)
[ERROR] at com.sun.tools.javac.Main.main(Main.java:42)
[ERROR] Caused by: java.lang.ClassNotFoundException: lombok.javac.handlers.HandleHelper
[ERROR] at java.lang.ClassLoader.findClass(ClassLoader.java:530)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[ERROR] at lombok.launch.ShadowClassLoader.loadClass(ShadowClassLoader.java:366)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[ERROR] at java.lang.Class.forName0(Native Method)
[ERROR] at java.lang.Class.forName(Class.java:348)
[ERROR] at lombok.core.SpiLoadUtil$1$1.next(SpiLoadUtil.java:111)


$ mvn -v
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T17:27:37+05:30)
Maven home: /usr/share/maven
Java version: 1.8.0_60, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-66-generic", arch: "amd64", family: "unix"

它没有从 Intellij 的想法中给出任何错误。

最佳答案

https://projectlombok.org/mavenrepo/ 所述,你应该定义对 lombok 的依赖与 provided范围。如下例

<dependencies> 
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.6</version>
<scope>provided</scope>
</dependency>
</dependencies>

关于maven - 在构建 maven 项目时获取 java.lang.ClassNotFoundException : lombok. javac.handlers.HandleHelper,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33349549/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com