【问题标题】:Lombok not working with Eclipse Neon 2 on macOS SierraLombok 无法在 macOS Sierra 上使用 Eclipse Neon 2
【发布时间】:2017-02-22 00:26:17
【问题描述】:

我在 macOS Sierra 和 Lombok 1.16.14 上使用 Eclipse Neon 2。

当我运行 Lombok 安装程序时,它找不到我的任何 Eclipse 或 IntelliJ IDEA 安装。

因此,我必须通过指向以下文件手动“指定位置”(没有其他目录或文件可以使“安装”按钮变为可点击):

eclipse-standard-neon2/Eclipse.app/Contents/Eclipse/eclipse.ini

安装后,它说“安装完成”,在 eclipse.ini 文件中,最后一行插入了以下行(我粘贴了 eclipse.ini 的全部内容):

-startup
../Eclipse/plugins/org.eclipse.equinox.launcher_1.3.201.v20161025-1711.jar
--launcher.library
../Eclipse/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.401.v20161122-1740
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.8
-XX:+UseG1GC
-XX:+UseStringDeduplication
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
-javaagent:../Eclipse/lombok.jar

lombok.jar 也被自动放置在与 eclipse.ini 相同的目录中:

eclipse-standard-neon2/Eclipse.app/Contents/Eclipse/

但是,当我启动 Eclipse Neon 2 并尝试使用任何 Lombok 注释时,即使我明确声明包导入,它也无法识别其类路径中的库。

另外,当我重新运行 Lombok 安装程序(为了卸载 Lombok)时,它仍然找不到我必须从以前的安装中手动指定的以前的 Eclipse IDE?

当我尝试使用以下命令从命令行运行 Eclipse 时(它仍然无法正常工作并且标准输出中没有列出任何错误):

eclipse-standard-neon2/Eclipse.app/Contents/MacOS$ ./eclipse -vmargs -javaagent:../Eclipse/lombok.jar

这是从标准输出运行的标准输出:

objc[52949]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/MacOS/libjli.dylib (0x100543480) and /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x1005a54e0). One of the two will be used. Which one is undefined.
org.eclipse.m2e.logback.configuration: The org.eclipse.m2e.logback.configuration bundle was activated before the state location was initialized.  Will retry after the state location is initialized.
Starting Groovy-Eclipse compiler resolver.  Specified compiler level: unspecified
671 2.4.8.xx-201702132212-e46 = STARTING
672 2.3.11.xx-201702132212-e46 = STARTING
org.eclipse.m2e.logback.configuration: Logback config file: /Users/devuser/DevTools/Java/eclipse/eclipse-standard-neon2/workspace/.metadata/.plugins/org.eclipse.m2e.logback.configuration/logback.1.7.0.20160603-1933.xml
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [bundleresource://462.fwk1881585646:1/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [bundleresource://462.fwk1881585646:2/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
org.eclipse.m2e.logback.configuration: Initializing logback

有人遇到过这个问题吗?

猜猜,我短期内不会有使用/学习 Lombok 的特权。 :(

【问题讨论】:

    标签: eclipse macos-sierra lombok


    【解决方案1】:

    您可以通过从菜单中打开 Help ? About Eclipse 对话框来验证 Lombok 是否安装正确。在右侧的白色区域,底线应为:Lombok v1.16.14 "Candid Duck" is installed. https://projectlombok.org/

    如果不是,请验证您的eclipse.ini。确保-javaagent:../Eclipse/lombok.jar 行低于-vmargs。您可以在此处尝试使用完整路径,它可能会从错误的位置解决。

    如果该行存在,但对话框中未显示 lombok 行,请尝试从命令行启动 Eclipse,查看是否收到错误消息。

    lombok 的下一个版本应该会找到这个安装。

    卸载程序不建议之前输入的位置的原因是 lombok 安装程序不会尝试记住任何内容。好处是目录移动不会干扰,lombok 安装程序不会在您的计算机上留下任何痕迹。

    披露:我是龙目岛开发人员。

    【讨论】:

    • 如果有人能解释我如何在 stackoverflow 消息中包含 (在这篇文章中围绕 -javaagent:lombok.jar),我将不胜感激。我宁愿不将 - 替换为 &x#2011; ('NON-BREAKING HYPHEN' ) 因为这会破坏复制粘贴代码的人员的安装。
    • 嗨 Roel,我刚刚通过提供 eclipse.ini 的完整列表更新了我的问题(见上文),是的,它位于 -vmargs 下。在 About Eclipse / Installation Details 中,Lombok 不存在。我还添加了 lombok.jar 的完整目录路径,但它仍然不起作用。这很可悲,因为我有其他版本的 Eclipse 和 IntelliJ,而安装程序无法检测到它们中的任何一个。 Lombok 团队为什么不直接为 Eclipse 和 IntelliJ IDEA 制作插件?
    • 嗨 Roel,我还在原始问题中添加了从命令行运行 Eclipse 的标准输出(见上文)。很失望,它不起作用。 :(
    • 下一个版本什么时候发布?
    • Lombok 所做的事情是 Eclipse 插件无法完成的。
    猜你喜欢
    • 2017-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-14
    • 1970-01-01
    • 1970-01-01
    • 2017-04-19
    • 2017-04-10
    相关资源
    最近更新 更多