简体   繁体   English

Lombok/Eclipse 问题 - 我可以编译但无法运行

[英]Lombok/Eclipse Issues - I can compile but I cannot run

I'm having an issue with Lombok or Eclipse, not sure which.我在使用 Lombok 或 Eclipse 时遇到问题,不确定是哪个。 I have a Spring Boot maven project for which I am using Lombok.我有一个 Spring Boot maven 项目,我正在使用 Lombok。 I've added this in my pom.xml file and I've used the lombok install for eclipse.我已经在我的 pom.xml 文件中添加了它,并且我已经为 eclipse 使用了 lombok 安装。

Whats happening is that I can do a mvn clean and a mvn install and a maven update on the project and everything builds as expected.发生的事情是我可以对项目执行mvn cleanmvn install以及 maven 更新,一切都按预期构建。 As soon as I go to run the project errors start to appear and I get error such as:一旦我 go 运行项目错误开始出现,我得到如下错误:

java.lang.Error: Unresolved compilation problems: 
    The method getxxx() is undefined for the type xxxxxx

Is there anything that can happen when running the project that can some how strip out lombok?!运行项目时是否会发生任何可以去除 lombok 的事情?!

I'm running Eclipse Oxygen (4.7.3) with lombok v1.16.18 "Dancing Elephant" any help would be much appreciated.我正在使用 lombok v1.16.18“Dancing Elephant”运行 Eclipse Oxygen (4.7.3) 任何帮助将不胜感激。

我不知道在eclipse中具体如何,但是在Intellij IDEA中我需要在设置中安装lombok插件,我怀疑在eclipse中也需要这样做。

Here is tested link for setting up lombok for the eclipse as well as intellij.这是为eclipse和intellij设置lombok的测试链接。

https://www.baeldung.com/lombok-ide https://www.baeldung.com/lombok-ide

Adding the tag <annotationProcessorPaths> to pom.xml solved my same problem.将标签<annotationProcessorPaths>添加到 pom.xml 解决了我同样的问题。

<build>
    <plugins>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <annotationProcessorPaths>
                    <path>
                        <groupId>org.projectlombok</groupId>
                        <artifactId>lombok</artifactId>
                        <version>RELEASE</version>
                    </path>
                </annotationProcessorPaths>
                ...
            </configuration>
        </plugin>
    </plugins>
</build>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM