Lombok problems with Eclipse Oxygen
EclipseLombokEclipse 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:
But when using the getters/setters and/or constructors in other classes I get the this errors:
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
-
Exit Eclipse(if it is open) and downloaded jar from https://projectlombok.org/download
-
execute command:
java -jar lombok.jar
-
This command will open window as shown here https://projectlombok.org/setup/eclipse, install and quit the installer.
-
Add jar to build path/add it to pom.xml.
e.g. for Gradle build
annotationProcessor("org.projectlombok:lombok")
compileOnly("org.projectlombok:lombok")
- restart eclipse.
- Go to Eclipse --> About Eclipse --> check 'Lombok v1.16.18 "Dancing Elephant" is installed. https://projectlombok.org/';
- 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
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:
-
Download lombok from the site Project Lombok;
-
Close your Eclipse IDE if it is open;
-
Trigger lombok installation either by following the official installation steps or by executing the command:
java -jar lombok.jar
; -
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
. -
Quit the installer and open Eclipse.
-
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.
-
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:
- Download the latest
lombok: 1.16.20
- Open up eclipse, and check for updates and install all of them. Ensure that eclipse is updated to the latest.
- Exit eclipse.
java -jar lombok.jar
- 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:
Fill in the "Start at" path and it will work:
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 :
-
Cleaning project
-
Building project
-
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:
- Close Eclipse
- Unlock Eclipse from your launcher
- Start Eclipse from the .desktop application
- Verify "Help --> About" indicates lombok is installed (scroll down)
- 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:
-
Install lombok 1.16.18 as instructed by lombok website. It's better Eclipse is close during installation.
-
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.
-
Once Eclipse opens, update Maven on the project to solve compilation errors.
-
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.
- In eclipse, goto 'Help'-> 'Install New Software ..'
- Enter https://projectlombok.org/p2 in 'Work with' and press Enter. Now it should look like below
- 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) :
- In eclipse, goto 'Help'-> 'About Eclipse IDE'.
- 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,
-
Download lombok-jar from https://projectlombok.org/download
-
Go to the directory where your lombok-jar is downloaded and run below command, java -jar lombok-1.18.4.jar
-
Specify the eclipse app location and then click on install/update and proceed. The below screen will get display,
Click on Quit installer.
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
when I reduced this to following version which worked for me
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
- First download the lombok jar ( add to pom , it will download . u can run from that location(from your maven repository location)
- run jar from you maven repo location (java -jar lombok.jar)
- select ur eclipse.exe location and install.
- 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.