Cannot make Project Lombok work on Eclipse

You not only have to add lombok.jar to the libraries, but also install it by either double-clicking the lombok jar, or from the command line run java -jar lombok.jar. That will show you a nice installer screen. Select your Eclipse installation and install.

Afterwards, you can check if the installer has correctly modified your eclipse.ini:

-vmargs
...
-javaagent:lombok.jar
-Xbootclasspath/a:lombok.jar

If your Eclipse was already running, you have to Exit Eclipse and start it again. (File/Restart is not enough)

If you are starting Eclipse using a shortcut, make sure that either there are no command line arguments filled in, or manually add -javaagent:lombok.jar -Xbootclasspath/a:lombok.jar somewhere after -vmargs.

Recent editions of Lombok also add a line to the About Eclipse screen. If Lombok is active you can find a line like 'Lombok v0.11.6 "Dashing Kakapo" is installed. http://projectlombok.org/' just above the line of buttons.

If for some reason, usually related to customized eclipse builds, you need to use the full path, you can instruct the installer on the command line to do so:

java -Dlombok.installer.fullpath -jar lombok.jar


Did you add

-vmargs
...
-javaagent:lombok.jar
-Xbootclasspath/a:lombok.jar

to your eclipse.ini?

Because if you have (and if you have added the lombok.jar to the libraries used by your project), it works just fine with Eclipse Helios:

alt text


Ian Tegebo mentions in the comments that:

a simple "restart" was not sufficient to pick up the changed vmargs:
I needed to explicitly exit and then start again.


chrisjleu mentions in the comments:

If you happen to be running a customized Eclipse Helios (3.6+) distribution then you may have to use the full path to lombok.jar in both the vm arguments.
See commit b47e87f for more details.

boolean fullPathRequired = IdeFinder.getOS() == EclipseFinder.OS.UNIX || System.getProperty("lombok.installer.fullpath") != null;

After adding lombok and restarting eclipse or spring tools my project still failed to recognize getters and setters. Red markers everywhere!

The solution: right-click your project, go to Maven and select Update Project

After hours of searching and trying random solution, I find this to be the only solution that worked for me.

enter image description here

Tags:

Eclipse

Lombok