龙目岛与Spring Tool Suite 4

问题描述 投票:2回答:7

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

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

任何的想法?

spring eclipse spring-tool-suite lombok
7个回答
16
投票

我几天前在Mac和Windows上安装了Lombok Spring Tool Suite 4。没有问题。

一:

执行java -jar lombok.jar

  • 注意:通常或默认情况下,它找不到安装程序,这是我的经验中常见的情况。

二:

Specify Location按钮。

  • 注意:对于Mac,请转到Contents文件中的.app目录并找到STS.ini文件,它也可能是SpringToolSuite4.ini

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

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


5
投票

虽然这可能会迟到,但它可以帮助其他人体验这一点。贝娄是我解决这个问题的方法

步骤1

在项目maven目录中找到lombok - >右键单击 - >运行方式 - > Java应用程序enter image description here

步骤2单击“指定位置”按钮,选择安装STS的路径

enter image description here

步骤3转到Application / Contents / Eclipse / SpringToolSuit4.ini然后单击Install - > Quick Installer enter image description here

步骤4重新启动STS你很高兴


2
投票

这些步骤对我来说都没有,因为文件对话框甚至不允许我选择包含SpringToolSuite4.ini的目录

所以我做了以下事情:

  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),请执行类似步骤

2
投票

我将向您展示如何将lombok完全安装到Spring Tool Suite 4或最新版本中。首先转到项目pom.xml文件,并在依赖项部分添加此依赖项。

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

转到IDE上的项目根文件夹,然后单击其上的右键。选择如下:

enter image description here

并确保选中“强制更新快照/版本”。单击“确定”以下载和更新依赖项。

enter image description here

完成所有任务后。转到项目Maven Dependencies并找到lombok.jar文件(> Maven Dependencies> lombok.jar)。右键单击lombok jar。转到Run As Java Application。

enter image description here

enter image description here

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

enter image description here

选择安装STS捆绑包的位置。如果选择正确,则会检查STS.exe,如下所示:

enter image description here

enter image description here

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

enter image description here

希望它能帮到你。谢谢。


1
投票

只是为了补充M. Jordan和神童的答案,请务必给lombok.jar执行权限

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

cd /Applications/SpringToolSuite4.app/Contents/Eclipse

然后检查lombok.jar是否可以使用执行权限

ls -al

如果你看到-rw-r - r--那就意味着你需要给予执行权限

chmod +x lombok.jar

或者你也可以这样做

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

然后重启STS


1
投票

我将SpringToolSuite4.exe和SpringToolSuite4.ini重命名为STS.exe和STS.ini。然后使用lombok安装程序的Specify Location来查找它们。安装lombok后,我将这些文件重命名为原始名称。


1
投票

在我的情况下,即使手动指向它,Lombok 1.16也无法找到STS 4安装。我尝试使用更新的Lombok版本 - Lombok 1.18后才工作。


0
投票

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

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

例如:

java -jar C:\Users\karthick\.m2\repository\org\projectlombok\lombok\1.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

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

© www.soinside.com 2019 - 2024. All rights reserved.