Lombok installation in Spring Tool Suite 4 for Windows

淺唱寂寞╮ 提交于 2020-07-08 03:31:05

问题


To install Lombok on one of my spring boot project on STS 4 in Windows 10 OS, I did the following steps:


  1. Added the lombok gradle dependency to build.gradle:

    compile 'org.projectlombok:lombok'

  2. Then to install the jar retrieved from building the above dependancy got a lombok-1.16.16.jar.

  3. To compile the jar did a right click on the jar -> Run as Java application.

  4. Lombok Installer appeared, but couldn't detect the IDE from the drives. So manually tried searching for the .exe file of STS4 (which I couldn't find)

So kindly help me find the .exe file of STS, so as to complete the installation


回答1:


The Spring Tool Suite 4 by default has a name as SpringToolSuite4 which is the executable file. This file doesn't get detected in the Lombok installer. After googling it for quite a long time, all I could see were results of how to install the same of Mac or Linux. Finally, had to experiment a little. Following is the solution:

  1. Rename the SpringToolSuite4 (Application(.exe)) file and (Configuration settings (.ini)) to sts and now it is detectable in the Lombok installer.
  2. Complete the installation and restart STS and rebuild-clean your project and it works just fine.



回答2:


You have to add the Lombok JAR file reference to the ini file. The inif file is in the STS installation directory:

-javaagent:<your-path-to-lobmok>lombok-1.16.16.jar



回答3:


If you are using Spring Tool Suite4, the name of the app is no longer STS.app on MacOS, however, the installer still uses the old name, which on macOS is part of the path. So if you use the installer, check the path in the .ini file to ensure that the name of the app used in the path is correct.




回答4:


After following the suggested lombok installation on the page https://projectlombok.org/setup/eclipse and if it doesn't work

go to C:\User\.m2\repository\org\projectlombok\lombok folder and remove all versions of lombok contained in the folder (do not worry maven will redo the files needed for lombok to work)

if using spring boot put in pom.xml:

<dependency>
   <groupId>org.projectlombok</groupId>
   <artifactId>lombok</artifactId>
</dependency>

and maven update with the force update option

I'am using Spring Tool Suite

Version: 3.9.4.RELEASE Build Id: 201804120943 Platform: Eclipse Neon.3 (4.6.3)



来源:https://stackoverflow.com/questions/56523530/lombok-installation-in-spring-tool-suite-4-for-windows

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