Lombok problems with Eclipse Oxygen
Asked Answered
S

29

64

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?

Shutdown answered 2/8, 2017 at 13:8 Comment(3)
It may be an issue with the annotation processor. Check if it is turned on.Berthoud
Wouldn't that mean that the @Override annotation is not working either? That's not the case tho.Shutdown
My problem solved was at my office computer when I run eclipse as administrator. (ofc after the lombok installation)Kiersten
F
110

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

Steps:

  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.

Farris answered 4/9, 2017 at 9:25 Comment(17)
BTW, I believe the installer does change your eclipse.ini, saving you the trouble of doing it by hand.Espadrille
This worked like a charm.But why does work with eclipse-oxygen and not with eclipse-photon??Wrenn
@Farris I used photon and the getter and setter methods never got resolved what ever I may do until I realized that the eclipse didn't have lombok while the project had. Thank you.Wrenn
Ohh, got it, @Eswar, fyi, you need to install Lombok plugin for IntelliJ-idea ide too in case if you wish to use in future.Farris
For me eclipse didn´t start after installing Lombok. I modified the eclipse.ini file specifiying the path to lombock.jar -javaagent:C:\YOUR_PATH_TO_ECLIPSE\eclipse\lombok.jarGaler
@LorenzoLerate what error you got while starting eclipse?Farris
@Farris something similar to this: #6334374Galer
@LorenzoLerate As it is mentioned in a screenshot above, If you start Eclipse with a custom -vm parameter, you'll need to add: -vmargs -javaagent:lombok.jar as parameter as well. I think you might have -vm parameter in eclipse.ini file.Farris
I did and Eclipse didn't start. I had to put the full pathGaler
@LorenzoLerate updated answer with your suggestions, thank you!Farris
Yes, the installer definitely does change your eclipse.ini. It tells you so if you click on the link in the installer to "show me how you will change my installation" or something similar. The two things the installer does are to copy itself to the same directory as your eclipse.ini, and to add a line with that path (the path to the copied jar) to your eclipse.ini.Spieler
@Farris as exactly as this problem mentioned above, Eclipse doesn't identify getters and setters. The method getId() is undefined for the type...Irizarry
@ChamithraThenuwara which eclipse version, which jdk version and lombok version?Farris
@Farris Eclipse Oxygen.3a Release (4.7.3a), java version "1.8.0_221", Lombok v1.16.14 "Candid Duck"Irizarry
@ChamithraThenuwara, try with lombok: v1.18.0, any reason to use older lombok version?Farris
@Farris that's the version my organization usesIrizarry
Thank you very much...I just learnt few things :)Unlimited
D
30

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.

  7. 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>
    
Decompose answered 19/9, 2017 at 9:59 Comment(2)
When you're looking in the Eclipse > About Eclipse box to verify Lombok is installed, be sure to scroll the text window down. What you're looking for appears in the text above the row of icons. Also, be sure to force a clean build of your project.Espadrille
@KCBaltz you're absolutely right! I'll update my post accordingly.Ninnette
A
10

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
Auntie answered 20/7, 2018 at 10:44 Comment(1)
Actually this worked for me Eclipse IDE Version: 2020-09 (4.17.0) Build id: 20200910-1200Esquiline
B
8

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/'
Belostok answered 26/9, 2021 at 5:33 Comment(1)
Note: Sometimes "Restart" eclipse doesn't work so instead the user should "Exit" and Start eclipse again.Loper
G
7

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.

Goodoh answered 20/11, 2017 at 6:52 Comment(1)
Awesome.. i had to do it twice.Inexplicable
J
6

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

Jamima answered 22/8, 2017 at 10:31 Comment(1)
Life Saver bro! - Thanx alot I was using: Eclipse IDE for Java Developers Version: Oxygen.1a Release (4.7.1a) Build id: 20171005-1200 OS: Windows 7, v.6.1, x86_64 / win32Moxie
V
6

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

Volcano answered 25/5, 2018 at 23:12 Comment(0)
D
4

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)

Demmer answered 6/2, 2018 at 19:47 Comment(2)
Spent so much time trying to make that thing work until I found your fix. Thanks a lot!!Slightly
Thank you, atlast find something that wokedRefugio
D
3

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

Discipline answered 4/1, 2018 at 15:45 Comment(0)
S
3

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

Steroid answered 13/12, 2020 at 13:11 Comment(1)
Easy step-by-step guide.Corona
I
2

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.

Illfated answered 13/2, 2018 at 20:20 Comment(0)
T
1

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

Tchad answered 6/8, 2017 at 18:48 Comment(0)
P
1

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)

Platinotype answered 30/11, 2017 at 11:56 Comment(0)
W
1

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.

Whitechapel answered 19/6, 2018 at 12:10 Comment(0)
L
1

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

Lepp answered 25/2, 2019 at 9:36 Comment(0)
C
1

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

Claviform answered 24/2, 2021 at 9:41 Comment(0)
M
0

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: Cannot make Project Lombok work on Eclipse (Helios)

Melissamelisse answered 2/8, 2017 at 13:59 Comment(1)
I restarted eclipse multiple times and I installed lombok by double clicking on the jar, where I could chose the installation path. So that's not it. Thanks thoShutdown
R
0

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
Responsive answered 3/10, 2018 at 16:44 Comment(0)
B
0

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

Bourke answered 13/10, 2019 at 6:9 Comment(0)
M
0

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

Mesmerize answered 12/6, 2020 at 10:49 Comment(0)
L
0

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.

Langham answered 5/7, 2020 at 13:49 Comment(0)
E
0

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.

Evaginate answered 26/8, 2020 at 16:1 Comment(0)
L
0

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

Lingo answered 3/8, 2021 at 14:59 Comment(0)
H
0

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
Harney answered 5/10, 2021 at 14:35 Comment(0)
R
0

Also before installing lombok check the java version. For latest releases of java version you need to download the latest lombok.jar from the below link. https://projectlombok.org/download

Rocket answered 26/9, 2022 at 15:9 Comment(0)
P
0

First step > Build Path

Go to: Maven Dependencies > Build Path > Configure Build Path Find Lombok dependency, click in its arrow then copy the full path from source attachment and paste into External annotations > restart your IDE and it'll work properly.

Partizan answered 12/3, 2023 at 2:53 Comment(0)
M
0

Lombok Annotations Not Recognized: Compilation Error Encountered : I encountered compilation errors because the annotations were not being recognized even after installing Lombok. To resolve this issue, I configured the build path and added the Lombok JAR as an external Maven dependency. This approach fixed the problem, and now Lombok annotations are working correctly. If you have any questions related to this topic,lets reply to me.refer screenshot as reference.

Milagrosmilam answered 11/4, 2024 at 13:10 Comment(0)
A
-1

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.

Apparel answered 4/9, 2018 at 8:44 Comment(0)
G
-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)

Geddes answered 9/7, 2022 at 19:41 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.