I have 2 classes in a Eclipse project.
package com.example;
import lombok.Getter;
import lombok.experimental.Accessors;
@Accessors(fluent = true)
@Getter
public class MyBean {
private String value = "aaa";
}
package com.example;
public class MyClass {
public static void main() {
System.out.println(new MyBean().value());
}
}
After building, Eclips reports "the value of the field value is not used"
for MyBean
class and "The method value() is undefined for the type MyClass"
even though Eclipse's content assist shows MyBean#value()
method, there are no warnings before building, and compilation, execution both are finished successfully. So I guess Lombok works properly and the problem is Eclipse doesn't recognize Lombok.
Here are what I tried and found.
Any ideas?
Finally, the problems are solved by just creating new project and moving all sources and resources to it. It seems that Eclipse's project configurations were broken I don't know why.
I install lombok on eclipse(java -jar lombokxxxx.jar) and the problem disapear.
Lombok API Configuration
Note: Lombok version may change. Present we are using 1.18.24
Lombok configuration window
will open > Click on Specify location
button Install / Update
button in Lombok configuration window
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.