2

Recently I have started using Netbeans(NB) 11. Previously I used NB 8.2. I opened my NB 8.2 projects in NB 11 where I have used Lombok. I noticed that NB 11 is giving red marks where i have used Getter/Setter of Lombok. But in the compile time it is working. As we know for Objects having Lombok Getter/Setter, if we press ctrl+space we get suggestion but for NB 11, no suggestion is showing. How can Lombok work for NB 11?

Update

I have also done

"In the project properties, in the section Build – Compiling, check the 'Enable Annotation Processing in Editor' checkbox."

enter image description here

Black Swan
  • 813
  • 13
  • 35
  • Are you using @Singular anywhere? This bug might be affecting you: https://github.com/rzwitserloot/lombok/issues/2093 – xathien Sep 05 '19 at 21:28

2 Answers2

0

You will need to do some configuration for Netbeans.

https://projectlombok.org/setup/netbeans

The Netbeans editor is compatible with lombok.

  1. Add lombok.jar to the project libraries.
  2. In the project properties, in the section Build – Compiling, check the 'Enable Annotation Processing in Editor' checkbox.

Also, check Lombok not working in a Netbeans project in case the above is not sufficient.

Community
  • 1
  • 1
Dio
  • 684
  • 2
  • 9
  • 18
  • @BlackSwan which versions of Lombok and Maven are you using? Can you paste block that imports the Lombok dependency? Which version of the maven-compiler-plugin do you use? – Dio May 22 '19 at 07:40
  • yes,i have tried with the latest version of lombok 1.18. but i am not sure from which version i have started to get problem cause as you know lombok jar file dont contain version number with jar file name. – Black Swan May 24 '19 at 17:03
  • 5
    This doesn't seem to work with a Maven based project –  Sep 20 '19 at 09:04
0

I got the same problem with

  • Netbean 14
  • Maven based project
  • JDK 16
  • Spring Boot (just info)

I managed to get the lombok annotation working fine by adding below configuration in the pom.xml, working fine mean it's showing in the auto-complete feature, not showing as error with red underline, and able to be compiled normally.

First, add the dependency for lombok maven

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok-maven-plugin</artifactId>
    <version>1.16.12.0</version>
</dependency>

Then add the annotation processor paths

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.3.2</version>
    <configuration>
        <debug>false</debug>
        <annotationProcessorPaths>
            <path>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>1.18.24</version>
            </path>
        </annotationProcessorPaths>
    </configuration>
</plugin>

After that, do the mvn clean package

enter image description here

aswzen
  • 1,512
  • 29
  • 46