38

Although I love lombok, it gives too much problems while configuring sometimes, specially in Linux. When I was trying to install it, I was getting the following error:enter image description here

I tried to set it up manually,as suggested here https://github.com/rzwitserloot/lombok/issues/95 but that didn't work out either. Any suggestions?

Heisenberg
  • 5,514
  • 2
  • 32
  • 43

30 Answers30

81
  • I have update the same on the following link.

Lombok not generating getter and setter STS

enter image description here

GoutamS
  • 3,535
  • 1
  • 21
  • 25
  • 6
    @Janet - I followed all the steps properly, still its not working for me. Any idea why? – PAA Sep 30 '17 at 19:37
  • 1
    In case of not working, please change lombok version.And try again – GoutamS Nov 21 '17 at 14:39
  • 2
    After above steps make sure to RESTART STS and then check in STS: "Help > About Spring Tool Suit" then scroll to the bottom of section and you should see something like: "Lombok v1.16.22 "Envious Ferret" is installed. https://projectlombok.org/" thanks GoutamS – ASH Jun 19 '18 at 13:17
  • 1
    What does step 1 in that image mean? "Include pom in Maven"? – GreenAsJade Dec 29 '18 at 06:35
  • @GreenAsJade , Install project lombok.jar in STS – GoutamS Jan 03 '19 at 17:47
  • In **MacOS**, the _Lombok Installer_ do not show the STS. Even pressing the **"Specify location..."** button, it do not allow me to select any of STS files at Application panel in Finder. Anyone had made it successfully in MacOS? – PedroPK Aug 19 '19 at 13:58
  • 2
    For me, I had to perform one more step which is placing Lombok jar under plugins and restarting. It worked!! – TechSingh Aug 20 '19 at 18:41
  • In case it keeps not working, you can move lombok to the same folder where sts is (the folder with `SpringToolSuite4.ini`), open `SpringToolSuite4.ini` and update the line referecing lombok to `-javaagent:lombok.jar` without the path – Alexandre Campos Oct 02 '20 at 02:34
  • With STS 4.14.0 and Lombok 1.18.20, I got errors like `Unable to make protected final java.lang.Class [...] module java.base does not "opens java.lang" to unnamed module` when opening editors. In my case, this could be resolved by adding `--add-opens=java.base/java.lang=ALL-UNNAMED` to the STS.ini file (from [here](https://stackoverflow.com/a/68134496/1302995)) – Sebastian Oct 31 '22 at 17:55
37

For whom the installer is throwing error while installation, this can be installed manually by following below steps.

  1. First close the STS.
  2. Copy lombok-x.xx.xx.jar from ~/.m2 repository. (E.g. ~\.m2\repository\org\projectlombok\lombok\1.16.14\lombok-1.16.14.jar)
  3. Rename the copied jar to lombok.jar and paste it in STS home directory right beside STS launcher exe (E.g. D:\spring-tool-suite-3.9.0.RELEASE-e4.7.0-win32-x86_64\sts-bundle\sts-3.9.0.RELEASE\)
  4. Open STS.ini (Name of this file can be different based on the STS version) and write -javaagent:lombok.jar line in the end .
  5. Restart STS
  6. Go to help>About Spring Tool Suit and check. You will see a message like "Lombok v1.16.14 "Candid Duck" is installed. https://projectlombok.org/"
  7. For any existing project error, RCL on the project, Go to Maven>Update Project.
Manish Bansal
  • 2,400
  • 2
  • 21
  • 37
29

For the STS on Mac OSX, choose the .ini file, not the .exe file.

This is the path on my Macbook.

/Applications/SpringToolSuite4.app/Contents/Eclipse/SpringToolSuite4.ini

It worked like a charm.

Young K. Jun
  • 391
  • 3
  • 5
  • 2
    After restart STS, you can go to top left corner, Spring Tool Suite 4 -> About Spring Tool Suite 4, scroll down the side bar on the right of top half screen, you will see "Lombok v1.18.24 "Envious Ferret" is installed. https://projectlombok.org/". – Janet Dec 01 '22 at 22:46
13

I had this problem despite successfully installing lombok and restarting STS, so:

  • shutting down STS and
  • starting it

worked (as opposed to restarting it). See this: http://codeomitted.com/setup-lombok-with-stseclipse-based-ide/

mystarrocks
  • 4,040
  • 2
  • 36
  • 61
9

It worked for me when I push the -javaagent arg to the top of the varargs list and restart the STS. By default Lombok adds this argument at the end in the ini file when you install. Eg:

-vmargs
-javaagent:lombok.jar
ThanhPhanLe
  • 1,315
  • 3
  • 14
  • 25
Yuva
  • 171
  • 2
  • 1
  • 1
    This worked for me. There were several references to the lombok.jar file including one that had "-vmargs -javaagent:lombok.jar". I removed the other references and split the line like you show above and it worked. Thanks! – John Apr 14 '20 at 19:49
  • I also added the lombok.jar file next to sts.exe as well as in the plugins folder. I'm not sure which is the correct placement. – John Apr 14 '20 at 19:50
  • 1
    The only thing that worked for me, I move the javaagent argument to the first vmargs and updated my maven project and boom it came alive. Thanks a lot @ThanhPhan – jaysman Mar 13 '22 at 15:59
  • This worked for me..but I wonder why? – vishal munde Sep 05 '22 at 11:35
6

I found a bug in Lombok's code. As they fixed it for STS in this commit:

https://github.com/rzwitserloot/lombok/commit/c3a3c09f4fd00b83814c1949fa5282ac9c595fa3

where they were always adding the end directory name twice. So for a work around I renamed my installation folder with same name as my parent folder.

Now while selecting the installation directory I'll choose the outer folder.

New installation directory: /home/ansh/softwares/sts/sts

New selected location for lombok: /home/ansh/softwares/sts

Heisenberg
  • 5,514
  • 2
  • 32
  • 43
6

Some people install STS and others just run them directly from the folder. This method works with ubuntu 18.04 and STS 4.5. Hope it is same for other Linux distros.

  1. Exit STS.

  2. Download Lombok from the official site. https://projectlombok.org/download

  3. Now run the jar. If you have installed STS it needs sudoers permission or using from folder no need of using sudo.

    sudo java -jar lombok.jar

  4. Now error pops up saying, Lombok cannot find the STS IDE, and asks us to manually select the STS runnable.

  5. If you have installed STS in your system you should find the path similar to this like,

    /opt/sts-4.5.1.RELEASE/SpringToolSuite4

    If you are using from the folder, just select the correct path to the runnable.

    /home/sysname/sts-4.5.1.RELEASE/SpringToolSuite4

  6. Now run "Install/Update" in the jar. It should show that Installation is successful.

  7. Now open the sts and clean / refresh your project.

prit4fun
  • 450
  • 1
  • 7
  • 15
5

Follow these steps:

  1. download lombok from https://projectlombok.org/download
  2. double click on lombok.jar and specify the path of your ide and click install.
  3. Restart your ide.
  4. clean your project. If you are using eclipse or sts, click on Project->clean..
Nabin Kumar Khatiwada
  • 1,546
  • 18
  • 19
3

If you are using STS4 and having custom -vm arguments like below in SpringToolSuite4.ini file.


-vm

C:\Program Files\RedHat\java-1.8.0-openjdk-1.8.0.242-3\bin\javaw.exe


Then you need add following to your SpringToolSuite4.ini file.


-vmargs

-javaagent:lombok.jar


I have already did below part:

  1. you can rename lombok-1.18.10 to lombok.jar.

  2. Copy lombok.jar as same path of SpringToolSuite4.ini file and install it. java -jar lombok.jar.

vijay patne
  • 81
  • 1
  • 2
3

This solution worked for me.

  1. Add maven dependency for Lombok
  2. Now you should be able to find lombok-1.18.20.jar (executable) in location C:\Users\abcd.m2\repository\org\projectlombok\lombok\1.18.20
  3. Go to the above location and in the command prompt execute the command as give below. java -jar lombok-1.18.20.jar enter image description here
  4. The above command will give a popup. Click on the "OK" button in the popup and click on the "specify location" button. Give the location to your STS installation as shown below, it should click on the "Install/Update" button enter image description here

enter image description here

enter image description here

Once you click on install/update, you can see the lambok.jar in the sts installation folder. see below.

enter image description here

  1. Copy this Lombok jar from the STS installation folder and paste it in the sts plugin folder.

enter image description here

  1. start your sts
  2. Now you can see all your error would have gone.
3

one more option

STS-> Help-> install new software (paste below url)

https://projectlombok.org/p2

select lombok -> next -> install

enter image description here

Imran khan
  • 819
  • 3
  • 12
  • 24
  • This works for me, but for that I tried restart millions time to STS, that shows it needs to tune otherwise people are moving towards community edition of IntelliJ, BTW thnx @Imran – Dnyaneshwar Jadhav Mar 06 '23 at 17:36
2

I installed the lombok by double click on the jar file, and selecting the spring tool suite IDE. Even after restart of IDE and rebuild of project after adding the jar manually to the project build path, the outline did not show up the getters and setters. Then placed the lombok jar file inside plugin folder of Spring tool suite, and restarted. The getter and setter started showing up in the class Outline window as below: enter image description here

  • I just logged in to rate this up and comment that this solved my problem. I had performed the jar steps as mentioned by Lombok's website (even GoutamS above). But this was the step missing (placing Lombok jar under plugins and restarting). Thanks bud! – TechSingh Aug 20 '19 at 18:39
  • Unfortunately, this solution did not fix the issue in my case. – Andy Nov 18 '19 at 03:23
2

I have the same issue of lombok not working on STS. For me root cause was that I have spaces in my STS installation directory

-javaagent:E:\Installation Directory with spaces\sts-X.X\lombok.jar

in STS.iniand after changing it to relative path

-javaagent:lombok.jar

lombok started working.

2

Exit from STS

  1. Copy lombok.jar near to SpringToolSuite4.ini file and install it(/Applications/SpringToolSuite4.app/Contents/Eclipse/ in my case):

java -jar lombok.jar

  1. Go to Terminal and run:

    cd /Applications/SpringToolSuite4.app/Contents/Eclipse/

  2. Run java -jar lombok.jar

    A GUI will be shown Choose Specify location.. from GUI Select path: SpringToolSuite4.app-Content-Eclipse-SpringToolSuite4.ini

A new line was inserted at the end of ini file (in my case was): -javaagent:/Applications/SpringToolSuite4.app/Contents/Eclipse/lombok.jar

I can guess you could manually add the line but you must have lombok.jar at the expected place in the path!

Clean the project.

Community
  • 1
  • 1
1

Double-click lombok.jar (downloadable from this site, or from your maven repository; it's the same jar).

This starts the eclipse/STS installer which will find eclipse (and eclipse variants as listed above), and offers to install lombok into these eclipse installations. The same tool can also uninstall lombok. Source: https://projectlombok.org/setup/eclipse

Lovish
  • 19
  • 3
1

If you download the version of STS below and follow the set up. Lombok works with STS perfectly.

Version: 4.7.0.RELEASE Build Id: 202006181331

Copyright (c) 2007 - 2020 Pivotal, Inc. All rights reserved. Visit https://spring.io/tools

This product includes software developed by the Eclipse Foundation https://www.eclipse.org

This product includes software developed by the Apache Software Foundation https://www.apache.org

Lombok v1.18.12 "Envious Ferret" is installed. https://projectlombok.org/

1

The main thing that everyone does is installing lombok as a jar and configuring with sts by double clicking on the jar, but forgetting to copy this lombok jar to the sts/eclipse installation folder.

Stephen
  • 8,508
  • 12
  • 56
  • 96
1
  1. Go to your maven local repository(e.g, .m2\repository\org\projectlombok\lombok\1.18.20) Then open the
    lombok jar & provide path of your SpringToolSuite4.exe.
  2. verify that lombok jar is in the same path as your SpringToolSuite4.exe &
    "-javaagent:C:\Users\sss\Downloads\sts-4.10.0.RELEASE\lombok.jar"
    this type of path in your SpringToolSuite4.ini.
  3. Then restart sts by closing sts & reopening manually. The restart feature of sts didn't work for me.
1

I tried the steps given in the accepted solution but it didnt work for me. I am using STS 4.12 . The issue that i found was , the latest sts 4.12 release comes with the following ini entries along with the changes done by lombok installer :

  -- {startup detail}
    -vmargs
    -Dosgi.requiredJavaVersion=11
  -- {vmargs details}
    -javaagent:C:\softwares_bkp\sts-4.12.0.RELEASE\lombok.jar

Changing the entry of -Dosgi.requiredJavaVersion to 1.8 worked for me.

Nishant_Singh
  • 748
  • 1
  • 6
  • 16
1

If you guys look carefully at the final Lombok installation popup then it is clearly mentioned:

enter image description here

I did exactly same and my issue was resolved. Below is my complete STS .ini:

-startup
plugins/org.eclipse.equinox.launcher_1.5.800.v20200727-1323.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.1300.v20200819-0940
-product
org.springframework.boot.ide.branding.sts4
--launcher.defaultAction
openFile
-vm
plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.0.v20201014-1246/jre/bin
-vmargs
-javaagent:lombok.jar
-Dosgi.requiredJavaVersion=11
-Dosgi.dataAreaRequiresExplicitInit=true
-Xms256m
-Xmx2048m
--add-modules=ALL-SYSTEM
-javaagent:C:\E_Drive\Softwares\SpringToolSuite\sts-4.8.1.RELEASE\lombok.jar
hagrawal7777
  • 14,103
  • 5
  • 40
  • 70
1

Post follow the above lombok installation steps might be for some people it's not working because If you are using company laptop then disconnect the VPN and Restart your machine. Then start your STS and observe. Lombok will be installed and all required setter getter builder and required constructor would be auto generated in model class and shown in outline.

0

On Linux, I copied lombook.jar file to STS folder. Then, I added below lines in STS.ini file

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

However it still didn't solve the issue. After starting STS with -clean it did work.

Go to the folder containing the STS file, and on the console run ./STS -clean.

Vishal Patel
  • 554
  • 6
  • 15
0

For anyone who has tried everything including manually pointing the STS location from lombok.jar and still failed to make it work, it could be due to permission issues regarding lombok.jar. Please see this answer by vancleff.

Kshitij Bajracharya
  • 811
  • 2
  • 14
  • 37
0
  1. I have deleted the all lombok versions from .m2 directory
  2. Again run the mvn install from the project and it installs the lombok jar in .m2
  3. copy to lombok jar to eclipse installation folder, ran java -jar lombok..jar and install it.
  4. Enable annotation processing in java complier in eclipse

It starts working.

My environment is - windows, java 8 and eclipse 2020-06.

0

if you are using sts4 and want to add lombok functionality then

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

2-copy it to the folder containing the SpringToolSuite4 executable file.

  1. open the SpringToolSuie4.ini text file and add if not already present. -vmargs -javaagent:lombok.jar

4 clean all the existing projects from project/clean in sts menu bar.

5 restart the application.

0
  1. Go to Maven repository and download latest Lombok jar.
  2. Run the jar from cmd; in my case it's java -jar lombok-1.18.16.jar.
  3. It opens a pop up asking you to configure Lombok with STS JDK. Browse the location of your STS.exe and paste it in the popup.
  4. Navigate to your STS downloaded folder, open the STS.ini file (type of this file is shown as configuration settings).
  5. Open the file with notepad and u should see a new line being added something like -javaagent your STS folder location lombok-jar

Restart your STS... you should be good.

Toby Speight
  • 27,591
  • 48
  • 66
  • 103
0

You can manually provide your IDE's location. probably similar /opt/sts-4.7.2.RELEASE/

2nd, if your IDE path has spaces, then IDE may error while start, for that problem: manually modify eclipse.ini or SpringToolSuite4.ini file with line

-javaagent:/home/<jar-path-here>/lombok.jar 
Akshay Sardhara
  • 129
  • 2
  • 7
0

I was using ubantu 18.04 with sts 4.12.1, I installed by running sudo java -jar lombok.jar, and selecting the spring tool suite IDE. Even after restart of IDE, rebuild and after adding the jar manually to the project build path, the lombok was not working fine. Then placed the lombok jar file inside plugin folder of Spring tool suite, and restarted. IT WORKED!!!

0

I had the same issue, that it contained two Lombok jar (one in my .m2 repository(in c drive) & other in my Project(where it was showing error)). I deleted one which was present in my .m2 repository and It Solved the Issue!!!

0

I am also faced the same problem even though modifying the sts.ini file. Finally, I did it by using the latest version of lombok.jar (1.18.26). I was using the following versions of STS and lombok

STS release version : Compatibility of Release 4.27 with 4.26 lombok.jar version : 1.18.26 It Worked For me