Lombok 不生成 getter 和 setter [英] Lombok is not generating getter and setter
问题描述
我只是尝试将基于 Maven 的项目发送到另一台计算机和 HORROR,到处都是红色标记!!
I just tried to send a Maven-based project to another computer and HORROR, red markers everywhere!!
但是,mvn clean install
构建得很好.
很快,我注意到 Lombok 没有为我的类生成 getter 和 setter,尽管 @Getter
和 @Setter
被 Eclipse 正确识别.
Quickly, I noticed that Lombok is not generating getters and setters for my classes, although the @Getter
and @Setter
are being correctly recognised by Eclipse.
两台计算机都使用相同的 Maven 版本 (3.0.4),但使用不同的 JDK(1.6_23 和 1.6_33).他们都使用 Eclipse Indigo 32 位.您对如何解决问题有想法吗?
Both computers use the same Maven version (3.0.4) but different JDKs (1.6_23 and 1.6_33). They both use Eclipse Indigo 32 bit. Do you have an idea about how to solve the problem?
推荐答案
当您开始安装全新的 Eclipse 时,实际上,您需要安装" Lombok 才能使用它.
When starting with a fresh eclipse installation you, in fact, need to "install" Lombok before being able to use it.
- 前往 Lombok jar 所在的位置(例如(例如(例如,您可以在
~/.m2/repository/org/projectlombok/lombok/1.16.10/lombok-1.16.10.jar
中找到),运行它(例如:java -jar lombok-1.16.10.jar
).应该会出现一个窗口,浏览到您的eclipse.exe
位置. - 点击安装.
- 启动 Eclipse,更新所有项目的项目配置,瞧.
- Go where you Lombok jar is (e.g. (e.g. you can find in
~/.m2/repository/org/projectlombok/lombok/1.16.10/lombok-1.16.10.jar
), run it (Example:java -jar lombok-1.16.10.jar
). A window should appear, browse to youreclipse.exe
location. - Click on install.
- Launch Eclipse, update project configuration on all projects and voila.
这篇关于Lombok 不生成 getter 和 setter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!