Lombok problems with Eclipse Oxygen

EclipseLombok

Eclipse Problem Overview


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
[email protected]/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?

Eclipse Solutions


Solution 1 - Eclipse

My env: java version "1.8.0_144"

Eclipse: Eclipse Java EE IDE for Web Developers. Version: Oxygen Release (4.7.0) Build id: 20170620-1800

  1. Exit Eclipse(if it is open) and downloaded jar from https://projectlombok.org/download

  2. execute command: java -jar lombok.jar

  3. This command will open window as shown here https://projectlombok.org/setup/eclipse, install and quit the installer.

  4. Add jar to build path/add it to pom.xml.

e.g. for Gradle build

 annotationProcessor("org.projectlombok:lombok")
 compileOnly("org.projectlombok:lombok")
  1. restart eclipse.
  2. Go to Eclipse --> About Eclipse --> check 'Lombok v1.16.18 "Dancing Elephant" is installed. https://projectlombok.org/';
  3. To enable Lombok for the project: Enable annotation processing in the respective IDE. That's it. It worked. I did not change eclipse init script.

> Note: Read the note in following image regarding -vm options If you start > Eclipse with a custom -vm parameter, you'll need to add:

-vmargs -javaagent:<path-to-lombok-jar>/lombok.jar

> as parameter as well

Above steps works for Photon Release (4.8.0) - Lombok v1.18.2, eclipse: Oxygen.3a Release (4.7.3a) - Lombok v1.18.0 and eclipse: Neon.3 Release (4.6.3) - Lombok v1.18.2

lombok success screen: enter image description here

fyi,
For JDK - 10 and 11 support: Lombok version should be at least v1.18.4 (October 30th, 2018) or higher.

Solution 2 - Eclipse

For MacBook Pro users (e.g. running macOs Sierra v10.12.6), in order to install lombok on Eclipse Oxygen (4.7.0) or Photon (4.8.0), using Java 1.8 (1.8.0_144), just do the following actions:

  1. Download lombok from the site Project Lombok;

  2. Close your Eclipse IDE if it is open;

  3. Trigger lombok installation either by following the official installation steps or by executing the command: java -jar lombok.jar;

  4. If the lombok installer doesn't find your Eclipse IDE, you will be requested to enter the path to your Eclipse. You should input the path to your eclipse.ini file. In my case was /tools/ide/eclipse/jee-oxygen/Eclipse.app/Contents/Eclipse/eclipse.ini.

  5. Quit the installer and open Eclipse.

  6. On the menu bar, go to Eclipse > About Eclipse and validate that lombok is installed:

    Lombok v1.16.18 "Dancing Elephant" is installed. https://projectlombok.org/
    

Be sure to scroll the text window down since the installed Lombok version appears in the text above the row of icons.

  1. Finally, add lombok to your project's build path according to the building tool you're using. For Maven, for instance, use the following dependency:

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

Solution 3 - Eclipse

https://stackoverflow.com/questions/42444457/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

Solution 4 - Eclipse

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.).

Solution 5 - Eclipse

Do not use old versions of java.

What happens is that lombok puts the following line in your eclipse.ini:

-javaagent: lombok.jar

And lombok.jar is in the C:\eclipse\jee-oxygen\eclipse directory

The problem is that the shortcut created by the windows installation looks like this:

enter image description here

Fill in the "Start at" path and it will work:

enter image description here

Solution 6 - Eclipse

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.

Solution 7 - Eclipse

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)

Solution 8 - Eclipse

Solution:

  1. Install lombok 1.16.18 as instructed by lombok website. It's better Eclipse is close during installation.

  2. Make sure Eclipse can start up properly. On the shortcut, change the properties, and fill in the "Start in" path and it will work as noted by Thomas and Fabiano.

  3. Once Eclipse opens, update Maven on the project to solve compilation errors.

  4. Now Lombok latest release works with Eclipse latest release.

For reference:

My Eclipse: Oxygen

Version: Oxygen.2 Release (4.7.2)
Build id: 20171218-0600 

My JRE/JDK: 1.8

java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)

lombok 1.16.18

Solution 9 - Eclipse

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/';

Solution 10 - Eclipse

I had the same problem, however, the original development was done with lombok 1.16.10 and I had installed 1.16.18. When I downloaded and installed 1.16.10 everything worked. I probably needed to do a few cleans and rebuilds to get it to work with .18, but if you're in a hurry, try that.

Solution 11 - Eclipse

Also had problems with lombok in eclipse oxygen.

My solution: returned from java version 8u144 to 8u141.

And I refer to lombok by adding this to my eclipse.ini:

-Xbootclasspath/c:/DEV/Tools/lombok-1.16.18/lombok.jar

-javaagent:/DEV/Tools/lombok-1.16.18/lombok.jar

Solution 12 - Eclipse

If restarting Eclipse doesn't help. You have to quit the application and make sure to kill all running java processes. That worked for me.

(Eclipse Oxygen 4.7.1a, OpenJDK 1.8.0_151-b12)

Solution 13 - Eclipse

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.

Solution 14 - Eclipse

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

Solution 15 - Eclipse

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

Solution 16 - Eclipse

Had similiar issue but really don't remember what helped me. Of course u can try restart Eclipse. Make sure you mentioned correct Eclipse path in lombok installation. That's the topic you can find other potential solutions: https://stackoverflow.com/questions/3418865/cannot-make-project-lombok-work-on-eclipse-helios/3425327#3425327

Solution 17 - Eclipse

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

Solution 18 - Eclipse

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

Solution 19 - Eclipse

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

Solution 20 - Eclipse

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.

Solution 21 - Eclipse

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.

Solution 22 - Eclipse

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

Solution 23 - Eclipse

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

Solution 24 - Eclipse

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

Solution 25 - Eclipse

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAlex P.View Question on Stackoverflow
Solution 1 - EclipsedkbView Answer on Stackoverflow
Solution 2 - EclipseAntónio RibeiroView Answer on Stackoverflow
Solution 3 - EclipseSnehal MasneView Answer on Stackoverflow
Solution 4 - EclipseKhanna111View Answer on Stackoverflow
Solution 5 - EclipseFabiano Costa LeiteView Answer on Stackoverflow
Solution 6 - EclipsekeicheeView Answer on Stackoverflow
Solution 7 - EclipseKreaseView Answer on Stackoverflow
Solution 8 - EclipseMichael QinView Answer on Stackoverflow
Solution 9 - EclipseTejasView Answer on Stackoverflow
Solution 10 - EclipseChris CView Answer on Stackoverflow
Solution 11 - EclipseRemon de KlerkView Answer on Stackoverflow
Solution 12 - Eclipsedeniss-sView Answer on Stackoverflow
Solution 13 - EclipseMarc MagonView Answer on Stackoverflow
Solution 14 - EclipseMaitree ShahView Answer on Stackoverflow
Solution 15 - EclipsePrateek PariharView Answer on Stackoverflow
Solution 16 - EclipseMichaƂ LisView Answer on Stackoverflow
Solution 17 - EclipseDeadpoolView Answer on Stackoverflow
Solution 18 - EclipseAshishView Answer on Stackoverflow
Solution 19 - EclipseHafiz HamzaView Answer on Stackoverflow
Solution 20 - EclipseManas Kumar MaharanaView Answer on Stackoverflow
Solution 21 - Eclipserajeev pani..View Answer on Stackoverflow
Solution 22 - Eclipsem PiroliView Answer on Stackoverflow
Solution 23 - EclipseShashi Bhushan JhaView Answer on Stackoverflow
Solution 24 - EclipseMikeView Answer on Stackoverflow
Solution 25 - EclipseFrancesco La GalaView Answer on Stackoverflow