javaintellij-ideabuilderlombok

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: 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


Solution

  • 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 :)