Lombok的Gradle不推荐使用的注释处理器警告 [英] Gradle deprecated annotation processor warnings for lombok

查看:1125
本文介绍了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...
}

这篇关于Lombok的Gradle不推荐使用的注释处理器警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆