mavennetbeans-8lombok

Lombok with Netbeans/Maven Annotations are not Recognized/Working


I tried to update my existing Lombok version 1.16.16 to 1.18.2 in Netbeans 8.2 (maven multi-module project).

Unfortunately, all versions higher than 1.16.18 are not working. No annotation is recognized and I get compile errors in the IDE. The pure maven build is working.


Solution

  • You have to configure the maven compiler plugin. Add the following snippet to the build section of your pom (at best to your parent pom or to each project which is using Lombok).

    If you already have a configuration of the build plugin in your pom make sure to add the <annotationProcessorPaths> section.

    This will ensure that Lombok is available during the compiling process to manipulate the AST.


    pom.xml - snippet

    ...
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>1.18.2</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
        </plugins>
    </build>
    ...