问题描述
我最近升级到新的Eclipse版本(Oxygen).我从网站上下载了lombok.jar并进行了安装.这是eclipse.ini
在安装后的样子:
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:\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
[email protected]/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,如下所示:
I can use Lombok as seen here:
但是当在其他类中使用getter/setter和/或构造方法时,会出现以下错误:
But when using the getters/setters and/or constructors in other classes I get the this errors:
这些也是我的Eclipse和Lombok版本:
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?
推荐答案
我的环境:Java版本"1.8.0_144"
My env: java version "1.8.0_144"
Eclipse:用于Web开发人员的Eclipse Java EE IDE.版本:氧气释放(4.7.0)版本号:20170620-1800
Eclipse:Eclipse Java EE IDE for Web Developers.Version: Oxygen Release (4.7.0)Build id: 20170620-1800
-
退出Eclipse(如果已打开)并从 https://projectlombok.org/download下载jar. a>
Exit Eclipse(if it is open) and downloaded jar from https://projectlombok.org/download
执行命令:java -jar lombok.jar
此命令将打开如下所示的窗口 https://projectlombok.org/setup/eclipse,安装并退出安装程序.
This command will open window as shown here https://projectlombok.org/setup/eclipse, install and quit the installer.
添加jar来构建路径/将其添加到pom.xml.
Add jar to build path/add it to pom.xml.
例如用于Gradle构建
e.g. for Gradle build
annotationProcessor("org.projectlombok:lombok")
compileOnly("org.projectlombok:lombok")
- 重新启动日食.
- 转到Eclipse->关于Eclipse->检查'Lombok v1.16.18"Dancing Elephant"是否已安装. https://projectlombok.org/'
- 要为项目启用Lombok:在相应的IDE中
Enable annotation processing
.而已.有效.我没有更改eclipse初始化脚本.
- 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.
-vmargs -javaagent:<path-to-lombok-jar>/lombok.jar
以上步骤适用于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
Above steps works for Photon Release (4.8.0)
- Lombok v1.18.2
, eclipse: Oxygen.3a Release (4.7.3a)
- Lombok v1.18.0
and eclipse: Neon.3 Release (4.6.3)
- Lombok v1.18.2
龙目岛成功画面:
fyi,
对于JDK-10和11 支持:Lombok版本至少应为v1.18.4(2018年10月30日)或更高.
fyi,
For JDK - 10 and 11 support:Lombok version should be at least v1.18.4 (October 30th, 2018) or higher.
这篇关于Eclipse氧气的Lombok问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!