Eclipse Oxygen 的 Lombok 问题 [英] Lombok problems with Eclipse Oxygen

查看:37
本文介绍了Eclipse Oxygen 的 Lombok 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近升级到了新的 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

  1. 退出 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

    1. Exit Eclipse(if it is open) and downloaded jar from https://projectlombok.org/download

    2. execute command: java -jar lombok.jar

    3. This command will open window as shown here https://projectlombok.org/setup/eclipse, install and quit the installer.

    4. Add jar to build path/add it to pom.xml.

      e.g. for Gradle build

     annotationProcessor("org.projectlombok:lombok")
     compileOnly("org.projectlombok:lombok")
    

    1. restart eclipse.
    2. Go to Eclipse --> About Eclipse --> check 'Lombok v1.16.18 "Dancing Elephant" is installed. https://projectlombok.org/'
    3. 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 and eclipse: 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆