简体   繁体   中英

How to fix: Lombok builder() method does not seem to be recognised in IntelliJ?

I am not sure what am I doing wrong. Can somebody please help me out

POM: 在此处输入图像描述

Implementation: 在此处输入图像描述

Using it as below: 在此处输入图像描述

The builder() method does not seem to be recognised. I am using IntelliJ. Is there something that I am missing?

Below are my intelliJ settings:

IntellijSettings - 1

IntellijSettings - 2

Assuming you use IntelliJ: You have to install Lombok Plugin in order to make it work:

  1. Go to File > Settings > Plugins
  2. Click on Browse repositories...
  3. Search for Lombok Plugin
  4. Click on Install plugin
  5. Restart IntelliJ IDEA

Aside from the dependency in the provided scope you have to enable the annotation processing (if you are using IntelliJ Idea) and install the Lombok Plugin .

  1.  <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>${lombok.version}</version> <scope>provided</scope> </dependency>
  2. Annotation processing: Navigate to File -> Settings -> Build, Execution, Deployment -> Compiler -> Annotation Processors and check Enable annotation processing .

    在此处输入图像描述

  3. Lombok Plugin: Navigate to File -> Settings -> Plugins and make sure the Lombok plugin is installed.

    在此处输入图像描述

  4. Restart IntelliJ Idea - The most likely missed part:)

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