Lombok problems with Eclipse Oxygen

Viewed 129197

I upgraded recently to the new Eclipse version (Oxygen). I downloaded the lombok.jar from the website and installed it. This is how the eclipse.ini looks like after installation:

-startup
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library
C:\Users\xxx\.p2\pool\plugins\org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.500.v20170531-1133
-product
org.eclipse.epp.package.jee.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m
-Declipse.p2.max.threads=10
-Doomph.update.url=http://download.eclipse.org/oomph/updates/milestone/latest
-Doomph.redirection.index.redirection=index:/->http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/
-javaagent:lombok.jar

I can use Lombok as seen here:

pojoclass outlineinfo

But when using the getters/setters and/or constructors in other classes I get the this errors:

codeInfo enter image description here

Also these are my Eclipse and Lombok versions:

Eclipse Java EE IDE for Web Developers.
Version: Oxygen Release (4.7.0)
Build id: 20170620-1800
Lombok v1.16.18 "Dancing Elephant" is installed. https://projectlombok.org/

Anyone knows how I can fix it?

26 Answers

Lombok does not work for Eclipse Neon

 - You should not just "restart" Eclipse, go to File -> Exit and then
   open it again.
 - Don't forget to do a mvn clean just to make sure that you recompiled your classes. 
 - After all this you should also right-click on your project, then Maven -> Update Project

I had exactly the same problem with Alex. My eclipse version is

Version: Oxygen.1a Release (4.7.1a) Build id: 20171005-1200

I installed lombok 1.16.18, after checking it was already installed and also javaagent line was added to my eclipse.ini file.

Every thing was fine except that there are compilation errors where getter is called in the project. It's awkward but I fixed by :

  1. Cleaning project

  2. Building project

  3. Restarting eclipse a few times

Nothing else.

Had problems with Eclipse Oxygen, Java 1.9 and Lombok (on Mac OSX - windows/linux should be similar).

This is what I had to do:

  1. Download the latest lombok: 1.16.20
  2. Open up eclipse, and check for updates and install all of them. Ensure that eclipse is updated to the latest.
  3. Exit eclipse.
  4. java -jar lombok.jar
  5. Ensure that the location to Eclipse is correct in the installer window that pops up, I had to explicitly specify:/[some-folder-heirarchy]/Eclipse.app/Contents/Eclipse/eclipse.ini

Thereafter check to see if the updates have made it in eclipse.ini:

-javaagent:/[some_folder-hierarchy]/eclipse-oxygen/Eclipse.app/Contents/Eclipse/lombok.jar

There is only one line that is updated. That is a change from some of the earlier versions of lombok where a bootclasspath was also specified and / or the path to lombok.jar was relative. Now it is an absolute path.

Bring up eclipse and you would see Lombok in action.

And do not forget to use the same Lombok version in your maven or any other dependency management tool.

Edit 1: I also used a different version of Lombok in the maven POM from the one that is installed in eclipse and for the most part, things compiled but there were a few compile errors in eclipse. Of course, things compiled successfully on the command line with maven. So if you have project dependencies that force you to use different Lombok versions then be aware of such an eventuality. The crux is to have the same version installed in both eclipse and in your project's dependency management (maven etc.).

I faced the same issue and struggled a lot to solve this issue. I was trying with lombok v1.18.14 which fails to setup on eclipse (as mentioned in changelog) so ensure you don't use it.

The below solution worked for me and it is simple to implement. This solution works for almost all eclipse versions.

  1. In eclipse, goto 'Help'-> 'Install New Software ..'
  2. Enter https://projectlombok.org/p2 in 'Work with' and press Enter. Now it should look like below enter image description here
  3. Select 'Lombok' and continue to setup. Once it is installed, restart eclipse.

To ensure Lombok is successfully installed, please follow below steps (after restarting eclipse) :

  1. In eclipse, goto 'Help'-> 'About Eclipse IDE'.
  2. In open dialog box, scroll down if necessary and check for below line 'Lombok v1.xx.xx "Envious Ferret" is installed. https://projectlombok.org/'

For Linux/Ubuntu users who are launching Eclipse from a launcher (a .desktop file) that is locked to your launcher, and your Help --> About dialog doesn't show lombok is installed:

  1. Close Eclipse
  2. Unlock Eclipse from your launcher
  3. Start Eclipse from the .desktop application
  4. Verify "Help --> About" indicates lombok is installed (scroll down)
  5. Lock to your launcher again

It seems this works due to some issue with applications 'lock to launcher', and it's the unlock/lock process that fixes it.

(Thanks to cardamon's comment here that pointed me to this solution)

Quite a few solutions, none solved my problem.

Eclipse Oxygen 3a April 2018 the installer works fine,

My issue was running eclipse on a DCEVM JRE. Pointing Eclipse to a non-modified JVM resolved this problem.

I am using STS. After performing installation of lombok.jar shown above, need to perform following task. STS -> Project -> Properties -> Java Compiler -> Annotation Processing -> Enable Annotation Processing. See here

Follow the below steps,

  1. Download lombok-jar from https://projectlombok.org/download

  2. Go to the directory where your lombok-jar is downloaded and run below command, java -jar lombok-1.18.4.jar

  3. Above command will open a window, enter image description here

  4. Specify the eclipse app location and then click on install/update and proceed. The below screen will get display, enter image description here

Click on Quit installer.

  1. Restart IDE. To check whether Lombok is installed or not. Got to -> About Eclipse -> enter image description here

  2. You will see the installed lombok as below, enter image description here

You can install lombok through command line very easily, ~/softwares/Eclipse.app/ path to your eclipse or sts app (this is on mac) but it will also work for different OS, and it will give you the successful output.

java -jar lombok.jar install ~/softwares/Eclipse.app/

Output:

Lombok installed to: /Users/temp/softwares/Eclipse.app

I tried all this but it didn't work for me. Lombok libraries were still not adding into my classpath.

I was using the latest spring-boot version

2.1.9.RELEASE

when I reduced this to following version which worked for me

2.1.7.RELEASE

If you have successfully installed Lombok and still facing the problem then right click on your project > maven > update project this should work.

follow below steps to fix lombok issue in eclipse

  1. First download the lombok jar ( add to pom , it will download . u can run from that location(from your maven repository location)
  2. run jar from you maven repo location (java -jar lombok.jar)
  3. select ur eclipse.exe location and install.
  4. Add jar to maven/class path

After this you will able to see these below lines in eclipse.ini file

-javaagent:locaton of lombok.jar
-Xbootclasspath/a:lombok.jar

Note - if any line missing after follow these steps then add into your eclipse.ini and enjoy ur work.

Same issue I have faced in eclipse. Installation was successful but I was seeing errors in my code. A simple maven update resolved this issue. In eclipse it is Alt+F5.

simplw way just download the lombok.jar open eclipse click with the right to project go to build path and add an external jar and import the jar restart the eclipse and everything is solve

NoteIf you are doing all the avobe thing while eclipse is running then you will not get the changes so just restart the eclise and you will fell the changes

Eclipse require specific java version

-vmargs
-Dosgi.requiredJavaVersion=11

and Lombok is not java version agnostic, source

So you need to chose compatible versions, for example

  • eclipse-2021-09-R
  • lombok-1.18.20
  • jdk-15.0.1

I solve it by deleting the project from Project Explorer, and import the project again.

Eclipse version: 2022-03 (4.23.0)

Lombok version: v1.18.24 (Envious Ferret)

Hello I solved that problem simply editing the lombok dependency in the pom.xml

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>1.16.16</version>
    <scope>provided</scope>
</dependency>

This version seems to work whit java 8.

Related