本文介绍了错误:升级到lombok 1.16.2后,包javax.annotation不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的android项目使用lombok 1.16.0可以很好地构建,但是一旦我将依赖关系更改为目标1.16.2,在使用lombok批注的任何地方都会出现以下错误:

My android project builds fine with lombok 1.16.0, but once I change my dependency to target 1.16.2, I get the following error everywhere I'm using a lombok annotation:

Error:(20, 1) error: package javax.annotation does not exist

Android SDK并不包含所有javax软件包.我想知道的是,这是1.16.2中的错误,还是我现在必须向javax.annotation添加依赖项?

The Android SDK does not include all javax packages. What I'm wondering is if this is a bug in 1.16.2 or do I now have to add a dependency to javax.annotation?

注意:这是在带有Lombok插件0.8.8的Android Studio中

Note: This is in Android Studio with Lombok plugin 0.8.8

推荐答案

您可以通过将以下行放在项目的顶级目录之一中的lombok.config文件中来禁用javax.annotation.Generated的生成:

You can disable the generation of javax.annotation.Generated by putting the following line in a lombok.config file in one of the top directories of your project:

lombok.addGeneratedAnnotation = false

有关更多信息,请参见配置文档.

See the configuration documentation for more information.

披露:我是Lombok开发人员.

Disclosure: I am a Lombok Developer.

这篇关于错误:升级到lombok 1.16.2后,包javax.annotation不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 04:53