Lombok not working with STS

后端 未结 18 1950
我在风中等你
我在风中等你 2020-12-14 06:49

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:

相关标签:
18条回答
  • 2020-12-14 07:29

    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.

    0 讨论(0)
  • 2020-12-14 07:30

    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.

    0 讨论(0)
  • 2020-12-14 07:31
    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 讨论(0)
  • 2020-12-14 07:32

    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.

    0 讨论(0)
  • 2020-12-14 07:35

    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.

    0 讨论(0)
  • 2020-12-14 07:37

    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

    0 讨论(0)
提交回复
热议问题