Lombok is not generating getter and setter
I just tried to send a Maven-based project to another computer and HORROR, red markers everywhere!!
However, mvn clean install
is building just fine.
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.
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?
When starting with a fresh eclipse installation you, in fact, need to "install" Lombok before being able to use it.
- 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.
If you use STS. You must have Lombok installed in your Eclipse by running lombok-xyz.jar
-
Please Try the Following the Steps:
- Include pom in Maven .
- Exit/Shutdown STS
- Find lombok Jar in ~/.m2/repository/org/projectlombok/lombok/version.x
From Command Prompt/Shell
java -jar lombok-1.x.y.jar
Start STS
Thats all.
EDIT: I did this and was still showing errors, as mentioned in the comments. So I updated the project: right-click on project -> Maven -> Update Project and the errors disappeared.
Note that if you're using IntelliJ, you'll want to install the Lombok plugin (available from IDE settings) and also enable annotation processing.
Download Lombok Jar, let’s maven do the download on our behalf :
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.18</version>
</dependency>
Now... mvn clean install command on the newly created project to get this jar downloaded in local repository. Goto the jar location, execute the command prompt, run the command : java -jar lombok-1.16.18.jar
click on the “Specify Location” button and locate the eclipse.exe path LIKE :
finally install this by clicking the “Install/Update”