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

Viewed 4406

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

POM: enter image description here

Implementation: enter image description here

Using it as below: enter image description here

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

2 Answers

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.

    enter image description here

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

    enter image description here

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

Related