Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 725
Chief Peter Avatar asked Dec 02 '25 22:12

Chief Peter


1 Answers

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>
...
like image 137
Paul Wasilewski Avatar answered Dec 05 '25 03:12

Paul Wasilewski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!