Lombok is not generating getter and setter
Solution 1
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.
Solution 2
If you use STS. You must have Lombok installed in your Eclipse by running lombok-xyz.jar
-
Please Try the Following the Steps:
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.
Solution 3
Note that if you're using IntelliJ, you'll want to install the Lombok plugin (available from IDE settings) and also enable annotation processing.
Solution 4
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”
Solution 5
If you use eclipse. You must have lombok installed in your Eclipse by running lombok-xyz.jar (e.g. you can find in ~/.m2/repository/org/projectlombok/lombok/1.12.6/lombok-1.12.6.jar
).
As the window of installation opened, you must choose the location of your Eclipse. And let it install lombok inside. You must restart your Eclipse afterwards.
Comments
-
Heetola over 2 years
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?
-
Roel Spilker almost 12 yearsFor full instructions, see stackoverflow.com/questions/3418865/… . This also incluses how to start Eclipse via a shortcut.
-
AncientSwordRage almost 11 yearspossible duplicate of Cannot make Project Lombok work on Eclipse (Helios)
-
logixplayer over 4 yearsI did all the above steps BUT it wasn't working still. I looked at pom.xml again and commented out <!-- <optional>true</optional> --> which came by default. I later add this <!-- <scope>provided</scope> --> but commented it out as well.
-
Net Dawg over 2 yearsWhy does only Lombok seem to have this problem, seems by design (to get attention)? Decorators from other annotation jars seem to just work after importing.
-
-
nanosoft about 9 yearsIf even after doing above steps it doesn't work, then EXIT and START eclipse again. Simple File->Restart doesn't work. Explicit EXIT and Start is necessary.
-
nanosoft about 9 years"Explicitly exit and then start again. ". Normal File-->Restart doesn't work.
-
Heetola about 9 yearsI believe I did this while eclipse was closed
-
nanosoft about 9 yearsIf it was closed then fine it work with next start. But if it is already started and Explicit EXIT and start is required.
-
SMT over 8 yearsWell done @Elidosa --- It's working, but yes need to Exit and start eclipse , only restart does't work
-
Aditya over 7 yearsI also needed to clean the projects to remove compilation errors
-
PAA over 6 yearsStill I am facing the issue not sure whats wrong is going on ?
-
GoutamS over 6 yearsDo you have any error message? Can you import the class in your Pojo Files?
-
GoutamS over 6 years@Prateek In case of not working, please change lombok version.And try again
-
Vikash about 6 yearsthanks nanosoft!.. I was doing File>restart and it wasn't working..had tried everything
-
ArifMustafa about 6 yearsI download the lombok.jar manually, ran it and later restarted eclipse and rebuilded projects, it's worked!...
-
MS Berends over 5 yearsWelcome to StackOverflow! Please try to write your answers more readable, by using correct lists and
markdown language like this
. -
Naseer Mohammad over 5 yearswhen I am trying to execute jar getting "Invalid or corrupt jarfile lombok-1.18.2.jar" What to do???
-
Vaibs about 5 yearsStill several would have come to this thread when they were facing the same thing and not knowing if the plugin is needed for the IntelliJ. thumbs up
-
sanimalp about 5 yearsIf any of the above still don't work, ensure the project can be otherwise built/compiled using maven/gradle. Then, delete the project from your workspace, and re-import it, ensuring the project build invocation completes successfully with lombok references in place.
-
Vikki over 4 yearsJust upgrade the Lombok Plugin in Intellij Idea and restart the IDE
-
Derick Daniel about 4 yearsThis is the simplest solution i ve found till now. It worked. Thanks.
-
YazidEF about 4 yearshere I am in year 2020 still finding your post useful. Thanks!
-
Rajeev about 4 yearsI had same issue tried everything but didn't work. Then what I did is, I installed fresh and before doing anything I installed Lombok. It worked. Also, make sure that you start with the fresh workspace. It didn't work with the old one.
-
Ben almost 4 yearsI followed all steps you described but with eclipse 2019-12 and lombok 1.18.12, eclipse does not recognize that there is a \@getter or \@setter annotation in my model. Is there even a getter or setter generated by lombok?
-
sofs1 almost 4 yearsHow come this answer didn't have even a single vote. THis really helped. Thanks a ton.
-
Tiago Medici almost 4 yearsit is duplicated answer
-
Demobilizer about 3 yearswhat in case of Netbeans? Where can I find Netbeans 12.3 location on ubuntu! I tried to /snap, but not working
-
Demobilizer about 3 yearsin case of Netbeans? any idea?
-
Tejas over 2 yearsTry stackoverflow.com/a/69332138/3637115, it worked for me.