简体   繁体   中英

Add Lombok plugin to IntelliJ

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

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)

lombok安装

  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.

您还需要将lombok插件安装到intellij。

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

转到Intellij中的首选项并安装Lombok Plugin。然后它就可以了

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM