Lombok的Gradle不推荐使用的注释处理器警告
升级到gradle 4.7后,以前没有警告的版本现在发出以下警告:
After upgrading to gradle 4.7, my previously warning-free build now emits this warning:
在编译类路径上检测到以下注释处理器:"lombok.launch.AnnotationProcessorHider $ AnnotationProcessor"和"lombok.launch.AnnotationProcessorHider $ ClaimingProcessor". 已弃用在编译类路径上检测注释处理器,Gradle 5.0将忽略它们.请改为将它们添加到注释处理器路径.如果您不打算使用注释处理器,则可以使用'-proc:none'编译器参数来忽略它们.
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.
似乎不赞成使用注释处理器,并且gradle 5.0版将不支持注释处理器.
It seems that annotation processors are deprecated and gradle version 5.0 will not support annotation processors.
我的项目使用lombok,它需要注释处理器,因此不能使用-proc:none
.发行Verison 5.0时,都没有停止使用Gradle.
My project uses lombok, which requries annotation processors, so using -proc:none
is not an option. Neither is stopping using Gradle when verison 5.0 is released.
我如何:
- 停止警告,然后
- 确保我的项目将在将来的Gradle版本中继续构建吗?
将lombok依赖项类型从compile
更改为annotationProcessor
,因此build.gradle
文件中的依赖项部分应如下所示:
Change the lombok dependency type from compile
to annotationProcessor
, so your dependencies section in your build.gradle
file should look like:
dependencies {
compileOnly('org.projectlombok:lombok:1.16.20')
annotationProcessor 'org.projectlombok:lombok:1.16.20'
// compile 'org.projectlombok:lombok:1.16.20' <-- this no longer works!
// other dependencies...
}