带有 Spring Tool Suite 4 的 Lombok

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/52780535/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 01:39:26  来源:igfitidea点击:

Lombok with Spring Tool Suite 4

springeclipsespring-tool-suitelombok

提问by Joaquín L. Robles

I've recently installed the new Spring Tool Suite 4 in macOS High Sierra but when I tried to run Lombok's installation it wouldn't find my STS installation,

我最近在 macOS High Sierra 中安装了新的 Spring Tool Suite 4,但是当我尝试运行 Lombok 的安装时,它找不到我的 STS 安装,

I followed this steps for manual installation (adding -javaagent to the ini file) but with no luck: https://www.edvpfau.de/sts-spring-tool-suite-4-mit-lombok/.

我按照此步骤进行了手动安装(将 -javaagent 添加到 ini 文件中)但没有运气:https: //www.edvpfau.de/sts-spring-tool-suite-4-mit-lombok/

Any idea?

任何的想法?

回答by Manuel Jordan

I did install Lombokin Spring Tool Suite 4just some days ago for Mac and Windows. And none problems.

我没有安装LombokSpring Tool Suite 4刚刚前几天适用于Mac和Windows。而且没有问题。

One:

Execute java -jar lombok.jar

执行 java -jar lombok.jar

  • Note: normally or by default, it does not find the installer, it is the common scenario in my experience.
  • 注意:通常或默认情况下,它找不到安装程序,这是我的经验中的常见情况。

Two:

Press the Specify Locationbutton.

按下Specify Location按钮。

  • Note:for Mac, go to the Contentsdirectory within the .appfile and find the STS.inifile, it could be SpringToolSuite4.initoo.
  • 注意:for Mac,进入文件Contents内的.app目录,找到STS.ini文件,也可以SpringToolSuite4.ini

Conclusion:therefore for any OS, the goal is find the uniquefile with the .iniextension

结论:因此对于任何操作系统,目标是找到具有扩展名的唯一文件.ini

Normally I do this with the IDE closed.

通常我会在 IDE 关闭的情况下执行此操作。

回答by Prodigy

Although this might be late, but it can be of help for others just experiencing this. Bellow is how I solved this issue

虽然这可能会晚,但它可以帮助其他人刚刚经历这个。波纹管是我如何解决这个问题

STEP 1

第1步

Find lombok in your project maven directory -> Right click -> Run As -> Java Application enter image description here

在你的项目 maven 目录中找到 lombok -> 右键单击​​ -> Run As -> Java Application enter image description here

STEP 2Click on Specify Location button to choose the path where STS is installed

STEP 2点击Specify Location 按钮选择安装STS的路径

enter image description here

enter image description here

STEP 3Go to Application/Contents/Eclipse/SpringToolSuit4.ini Then click on Install -> Quick Installer enter image description here

STEP 3进入 Application/Contents/Eclipse/SpringToolSuit4.ini 然后点击 Install -> Quick Installer enter image description here

STEP 4Restart STS you good to go

步骤 4重新启动 STS,一切顺利

回答by BigRedBettaFish

I renamed SpringToolSuite4.exeand SpringToolSuite4.inito STS.exeand STS.ini. Then used lombok installer's Specify Location to find them. After lombok installed, I renamed those files back to their original names.

我将SpringToolSuite4.exeSpringToolSuite4.ini重命名为STS.exeSTS.ini。然后使用 lombok 安装程序的指定位置来找到它们。安装 lombok 后,我将这些文件重命名为其原始名称。

回答by vancleff

Just to add to M. Jordan's and prodigy's answer, please be sure to give execute permission to lombok.jar

只是为了补充 M. Jordan 和 prodigy 的回答,请务必授予 lombok.jar 执行权限

(After you follow the above-mentioned step) Open terminal and change directory to the content of SpringToolSuite.app

(按照上述步骤操作后)打开终端并将目录更改为 SpringToolSuite.app 的内容

cd /Applications/SpringToolSuite4.app/Contents/Eclipse

Then check whether execute permission is available to lombok.jar

然后检查lombok.jar是否有执行权限

ls -al

If you see -rw-r--r-- it means you need to give execute permission

如果看到 -rw-r--r-- 表示需要授予执行权限

chmod +x lombok.jar

alternatively you could also do

或者你也可以做

chmod +x /Applications/SpringToolSuite4.app/Contents/Eclipse/lombok.jar

Then restart STS

然后重启STS

回答by user07

In my case, Lombok 1.16 could not locate STS 4installation even after pointing to it manually. Worked only after I tried with updated Lombok version - Lombok 1.18.

就我而言,即使手动指向Lombok 1.16 也无法找到STS 4安装。仅在我尝试使用更新的 Lombok 版本 - Lombok 1.18后才起作用

回答by Subarata Talukder

I'll show you how to completely install lombok into Spring Tool Suite 4 or latest version. First go to your project pom.xml file and add this dependency on dependencies section.

我将向您展示如何将 lombok 完全安装到 Spring Tool Suite 4 或最新版本中。首先去你的项目pom.xml文件,并添加依赖节这种依赖性。

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

Go to your project root folder on your IDE and click the right button on it. Select like below:

转到您的IDE项目的根文件夹,点击它右边的按钮。选择如下:

enter image description here

enter image description here

And make sure, checked Force Update of Snapshots/Releases. Click Ok to download and update dependencies.

并确认,检查快照/发布的强制更新。单击确定下载并更新依赖项。

enter image description here

enter image description here

After finishing all task. Go to project Maven Dependencies and find lombok.jar file (>Maven Dependencies >lombok.jar). Right click on lombok jar. Go to Run As Java Application.

完成所有任务后。转到项目 Maven Dependencies 并找到 lombok.jar 文件(>Maven Dependencies >lombok.jar)。右键单击 lombok jar。转到作为 Java 应用程序运行。

enter image description here

enter image description here

enter image description here

enter image description here

It will open lombok installer window and click ok. Then click Specify Location button.

它将打开 lombok 安装程序窗口并单击确定。然后单击指定位置按钮。

enter image description here

enter image description here

Select the location where your STS bundle was installed. If it is selected properly then it will checked STS.exe, like below:

选择安装 STS 包的位置。如果选择正确,它将检查 STS.exe,如下所示:

enter image description here

enter image description here

enter image description here

enter image description here

Then click install/update button. Finally lombok will be installed successfully.

然后单击安装/更新按钮。最后lombok就安装成功了。

enter image description here

enter image description here

Hopefully it helps you. Thanks.

希望对你有帮助。谢谢。

回答by Kundan Burnwal

None of the steps worked for me as the file dialog box won't even let me select the directory containing the SpringToolSuite4.ini

这些步骤都不适合我,因为文件对话框甚至不允许我选择包含 SpringToolSuite4.ini

So I did the following:

所以我做了以下事情:

  1. Get lombok-<version>.jarfrom either your ~/.m2/repository/org/projectlombok/lombok/<latest-version>/If not available you can get it from mvn repository: https://mvnrepository.com/artifact/org.projectlombok/lombok/1.18.6

  2. copy the lombok-<version>.jarto /Applications/SpringToolSuite4.app/Contents/Eclipseas lombok.jar

    cp /path/to/lombok.jar /Applications/SpringToolSuite4.app/Contents/Eclipse/
    
  3. Edit the file: /Applications/SpringToolSuite4.app/Contents/Eclipse/SpringToolSuite4.iniinside the directory to add this last line:

    -javaagent:/Applications/SpringToolSuite4.app/Contents/Eclipse/lombok.jar
    
  4. Open your project in eclipse. Right click on Maven -> update project. Follow similar step if you're using another build tool (like Gradle)

  1. lombok-<version>.jar从您的任何一个获取~/.m2/repository/org/projectlombok/lombok/<latest-version>/如果不可用,您可以从 mvn 存储库获取它:https: //mvnrepository.com/artifact/org.projectlombok/lombok/1.18.6

  2. 复制lombok-<version>.jar/Applications/SpringToolSuite4.app/Contents/Eclipse作为lombok.jar

    cp /path/to/lombok.jar /Applications/SpringToolSuite4.app/Contents/Eclipse/
    
  3. 编辑文件:/Applications/SpringToolSuite4.app/Contents/Eclipse/SpringToolSuite4.ini在目录中添加最后一行:

    -javaagent:/Applications/SpringToolSuite4.app/Contents/Eclipse/lombok.jar
    
  4. 在 Eclipse 中打开您的项目。右键单击 Maven -> 更新项目。如果您使用其他构建工具(如 Gradle),请遵循类似的步骤

回答by Mohit Bansal

I faced same issue with for Spring tool suite 4

我在 Spring 工具套件 4 中遇到了同样的问题

Solution

解决方案

  1. Close running STS.

  2. Open terminal

  3. Go to ~/.m2/repository/org/projectlombok/lombok/version

  4. Run java -jar lombok-version.jar Pop window will come.
  5. If it does not pick up the STS itself. Then chose specify location Choose SpringToolSuite4.ini at ?Applications? ? ?SpringToolSuite4? ? ?Contents? ? ?Eclipse? .
  6. Click install
  7. After this Starts Spring tool suite and clean project.
  1. 关闭正在运行的 STS。

  2. 打开终端

  3. 转到 ~/.m2/repository/org/projectlombok/lombok/版本

  4. 运行 java -jar lombok- version.jar 会弹出窗口。
  5. 如果它不拿起 STS 本身。然后选择指定位置 选择 SpringToolSuite4.ini at ?Applications? ? ?SpringToolSuite4?? ?内容?? ?蚀?.
  6. 点击安装
  7. 在此之后启动 Spring 工具套件和清理项目。

回答by Nishikant

on macOS Catalina all I had to do was to use lombok 1.18 and all worked fine.

在 macOS Catalina 上,我所要做的就是使用 lombok 1.18 并且一切正常。

回答by karthick S

the easiest way you can do is that by running the following command on command prompt

最简单的方法是在命令提示符下运行以下命令

java -jar (jar location/lombok.1.8.1.jar) install (the path where you installed Spring tool suite(STS))

for example:

例如:

java -jar C:\Users\karthick\.m2\repository\org\projectlombok\lombok.18.8\lombok-1.18.8.jar install D:\STS_Tool\spring-tool-suite-4-4.1.2.RELEASE-e4.10.0-win32.win32.x86_64\sts-4.1.2.RELEASE

after that, you have to restart the tool.

之后,您必须重新启动该工具。