我最近升级到新的 Eclipse 版本 (Oxygen)。我从网站下载了 lombok.jar 并安装了它。 eclipse.ini
是这样的安装后的样子:
-startup
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library
C:\Users\xxx\.p2\pool\plugins\org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.500.v20170531-1133
-product
org.eclipse.epp.package.jee.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m
-Declipse.p2.max.threads=10
-Doomph.update.url=http://download.eclipse.org/oomph/updates/milestone/latest
-Doomph.redirection.index.redirection=index:/->http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/
-javaagent:lombok.jar
我可以使用 Lombok,如下所示:
但是当在其他类中使用 getter/setter 和/或构造函数时,我得到了这个错误:
这些也是我的 Eclipse 和 Lombok 版本:
Eclipse Java EE IDE for Web Developers.
Version: Oxygen Release (4.7.0)
Build id: 20170620-1800
Lombok v1.16.18 "Dancing Elephant" is installed. https://projectlombok.org/
有谁知道我该如何修复它?
最佳答案
我的环境:java 版本“1.8.0_144”
eclipse :
面向 Web 开发人员的 Eclipse Java EE IDE。
版本:氧气释放(4.7.0)
版本号:20170620-1800
java -jar lombok.jar
例如用于 Gradle 构建
annotationProcessor("org.projectlombok:lombok")
compileOnly("org.projectlombok:lombok")
Enable annotation processing
在相应的 IDE 中。就是这样。有效。
我没有更改 eclipse init 脚本。
Note: Read the note in following image regarding -vm options If you start Eclipse with a custom -vm parameter, you'll need to add:
-vmargs -javaagent:<path-to-lombok-jar>/lombok.jar
as parameter as well
以上步骤适用于
Photon Release (4.8.0)
- Lombok v1.18.2
, eclipse: Oxygen.3a Release (4.7.3a)
- Lombok v1.18.0
和 eclipse: Neon.3 Release (4.6.3)
- Lombok v1.18.2
Lombok 成功画面:
供引用,
对于 JDK - 10 和 11 support :
Lombok 版本至少应为 v1.18.4(2018 年 10 月 30 日)或更高版本。
关于eclipse - Eclipse Oxygen 的 Lombok 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45461777/