Gradle DSL method not found: 'annotationProcessor()'
Possible causes:<ul><li>The project 'wq-handler-service' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Upgrade plugin to version 2.3.2 and sync project</li><li>The project 'wq-handler-service' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file</li><li>The build file may be missing a Gradle plugin.
Apply Gradle plugin</li>
6 回答
你需要 Enable Annotation Processing IntelliJ IDEA
> Settings > Build, Execution, Deployment > Compiler > Annotation Processors
添加Lombok IntelliJ插件以添加lombok支持IntelliJ:
转到文件>设置>插件
点击浏览存储库...
搜索Lombok插件
点击安装插件
重启IntelliJ IDEA
您需要在Intellij设置中激活项目的插件
设置 - >其他设置 - > Lombok插件
我刚刚发现了 .
我删除了编译器抱怨的第一次出现的lombok
@Slf4j
或log
,并等待IDEA的警告(红色气泡),建议"add the lombok.extern.Slf4j.jar to classpath" . 从那时起一切顺利 . 似乎IDEA喜欢抱怨lombok .如果在安装
lombok intellij plugin
并启用注释处理后,如果仍未在intellij中识别出getter和setter,请检查plugin
版本是否与您使用的intellij
版本兼容 .它列在下载部分下面:
对我来说,在完成问题和最佳答案中建议的所有步骤后,它无法正常工作 . 最初导入不起作用,然后当我重新启动IntelliJ时,我从Gradle插件获得了这些消息:
这很奇怪,因为我没有为Android开发,只是使用IntelliJ for Mac OS .
公平地说,我的
build.gradle
文件在dependencies
部分中有这些行,我是从同事那里复制的:在检查版本之后,唯一能完全解决我问题的是将以下内容添加到
build.gradle
的plugins
部分,我在page找到了:看起来像是一个
(ltgt plugin page)