Add Lombok plugin to IntelliJ

痴心易碎 提交于 2019-12-10 18:17:19

问题


Intellij doesn't recognize Spring annotations and I think its connected to Lombok.

I added the plugin in IntelliJ settings and enabled annotation processing

I am using maven and I have this dependency

dependency>
       <groupId>org.projectlombok</groupId>
       <artifactId>lombok</artifactId>
       <scope>provided</scope>
</dependency>

Still Intellij can't recognize Slf4j and Spring annotations


回答1:


Follow the steps
1. Build spring application as mentioned in: https://spring.io/guides/gs/spring-boot/

  1. Install Lombok in IntelliJ (check compatibility with your version of IntelliJ idea)

  1. Add as a dependency in (pom.xml/build.gradle/other build files)
<dependency>
   <groupId>org.projectlombok</groupId>
   <artifactId>lombok</artifactId>
   <scope>provided</scope>
</dependency>
  1. Build project

  2. 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.

If you still face issue do once File/Invalidate caches/Invalidate and restart

That's it.




回答2:


You need to install the lombok plugin to intellij as well.

Files->Settings->Plugins->Click on Browse repositories->Search for Lombok->Install plugin->Restart Intellij



回答3:


Go to preferences in Intellij and install Lombok Plugin.Then it will work



来源:https://stackoverflow.com/questions/54005654/add-lombok-plugin-to-intellij

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!