Eclipse Oxygen 的 Lombok 问题 [英] Lombok problems with Eclipse Oxygen
问题描述
我最近升级到了新的 Eclipse 版本 (Oxygen).我从网站下载了 lombok.jar 并安装了它.这是eclipse.ini
安装后的样子:
-启动插件/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar--launcher.libraryC:Usersxxx.p2poolpluginsorg.eclipse.equinox.launcher.win32.win32.x86_64_1.1.500.v20170531-1133-产品org.eclipse.epp.package.jee.product-showsplashorg.eclipse.epp.package.common--launcher.defaultAction打开文件--launcher.appendVmargs-vmargs-Dosgi.requiredJavaVersion=1.8-Dosgi.instance.area.default=@user.home/eclipse-workspace-XX:+使用G1GC-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 版本:
面向 Web 开发人员的 Eclipse Java EE IDE.版本:氧气释放 (4.7.0)版本号:20170620-1800Lombok v1.16.18 《跳舞的大象》安装完毕.https://projectlombok.org/
有谁知道我该如何修复它?
My env: java version "1.8.0_144"
日蚀:面向 Web 开发人员的 Eclipse Java EE IDE.版本:氧气释放 (4.7.0)版本号:20170620-1800
退出 Eclipse(如果它是打开的)并从
仅供参考,
对于 JDK - 10 和 11 支持:Lombok 版本至少应为 v1.18.4(2018 年 10 月 30 日)或更高版本.I upgraded recently to the new Eclipse version (Oxygen). I downloaded the lombok.jar from the website and installed it. This is how the
eclipse.ini
looks like after installation:-startup plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar --launcher.library C:Usersxxx.p2poolpluginsorg.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
I can use Lombok as seen here:
But when using the getters/setters and/or constructors in other classes I get the this errors:
Also these are my Eclipse and Lombok versions:
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/
Anyone knows how I can fix it?
解决方案My env: java version "1.8.0_144"
Eclipse: Eclipse Java EE IDE for Web Developers. Version: Oxygen Release (4.7.0) Build id: 20170620-1800
Exit Eclipse(if it is open) and downloaded jar from https://projectlombok.org/download
execute command:
java -jar lombok.jar
This command will open window as shown here https://projectlombok.org/setup/eclipse, install and quit the installer.
Add jar to build path/add it to pom.xml.
e.g. for Gradle build
annotationProcessor("org.projectlombok:lombok") compileOnly("org.projectlombok:lombok")
- restart eclipse.
- Go to Eclipse --> About Eclipse --> check 'Lombok v1.16.18 "Dancing Elephant" is installed. https://projectlombok.org/'
- To enable Lombok for the project:
Enable annotation processing
in the respective IDE. That's it. It worked. I did not change eclipse init script.
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
Above steps works for
Photon Release (4.8.0)
-Lombok v1.18.2
,eclipse: Oxygen.3a Release (4.7.3a)
-Lombok v1.18.0
andeclipse: Neon.3 Release (4.6.3)
-Lombok v1.18.2
lombok success screen:
fyi,
For JDK - 10 and 11 support: Lombok version should be at least v1.18.4 (October 30th, 2018) or higher.这篇关于Eclipse Oxygen 的 Lombok 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!