将Lombok插件添加到IntelliJ [英] Add Lombok plugin to IntelliJ
问题描述
Intellij无法识别Spring注释,我认为它与Lombok有关.
Intellij doesn't recognize Spring annotations and I think its connected to Lombok.
我在IntelliJ设置中添加了插件,并启用了注释处理
I added the plugin in IntelliJ settings and enabled annotation processing
我正在使用maven,并且具有这种依赖关系
I am using maven and I have this dependency
dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
仍然Intellij无法识别Slf4j和Spring批注
Still Intellij can't recognize Slf4j and Spring annotations
推荐答案
按照步骤操作
1.如以下内容所述,构建spring应用程序: https://spring.io/guides/gs/spring-boot/
Follow the steps
1. Build spring application as mentioned in: https://spring.io/guides/gs/spring-boot/
- 在IntelliJ中安装Lombok(使用您的IntelliJ idea版本检查兼容性 )
- 在(pom.xml/build.gradle/其他构建文件)中添加为依赖项
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
-
构建项目
Build project
在IntelliJ中启用注释处理(每次导入新项目时都必须执行此操作,如果要默认启用它,请按照
Enable annotation processing in IntelliJ(You have to do this every time you import new project, if you want it to be enabled by default then follow steps mention in this SO OP.
File
| Other Settings
| Default Settings
, navigate to the compiler settings, annotation processing and enable this option before importing the project.
如果仍然遇到问题,请执行一次File
/Invalidate caches
/Invalidate and restart
If you still face issue do once File
/Invalidate caches
/Invalidate and restart
就是这样.
这篇关于将Lombok插件添加到IntelliJ的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!