我在使用Gradle 4.7项目时收到以下消息
The following annotation processors were detected on the compile classpath: 'lombok.launch.AnnotationProcessorHider$AnnotationProcessor' and 'lombok.launch.AnnotationProcessorHider$ClaimingProcessor'. Detecting annotation processors on the compile classpath is
Deprecated and Gradle 5.0 will ignore them. Please add them to the annotation processor path instead. If you did not intend to use annotation processors, you can use the '-proc:none' compiler argument to ignore them.
运行时
gradlew build --warning-mode=all
在具有以下渐变配置的项目上
compileOnly('org.projectlombok:lombok')
testCompileOnly('org.projectlombok:lombok')
如警告所示,建议将其放在
annotationProcessor
(和)
testAnnotationProcessor
)配置以与Gradle 5.0兼容
annotationProcessor('org.projectlombok:lombok')
testAnnotationProcessor('org.projectlombok:lombok')
但是,通过简单的测试:
@Slf4j
public class LombokTests {
@Test
public void lombokCompiles() {
log.info("foobar");
}
}
配置失败:
> Task :compileTestJava FAILED
D:\Users\bobjones\repos\my-new-app\src\test\java\com\example\app\LombokTests.java:10: error: cannot find symbol
@Slf4j
^
symbol: class Slf4j
1 error
我错过什么了吗?