Lombok not working with STS

可紊 提交于 2019-11-29 18:11:30

问题


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:

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?


回答1:


  • I have update the same on the following link.

Lombok not generating getter and setter STS




回答2:


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.




回答3:


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




回答4:


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




回答5:


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:




回答6:


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.



回答7:


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/




回答8:


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



回答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



回答10:


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.




回答11:


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.



来源:https://stackoverflow.com/questions/35842751/lombok-not-working-with-sts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!