Lombok added but getters and setters not recognized in Intellij IDEA
Solution 1
I fixed it by ticking the "Enable annotation processing" checkbox in Settings->Compiler->Annotation Processors.
Along with this you might also need to install lombok
plugin as mentioned in @X.Chen's answer for new versions of IntelliJ Idea.
Solution 2
You need to install the Lombok plugin for IDEA. Open the Settings panel (Ctrl + Alt + S). Search for "Plugins", then search for "Lombok" in the plugins. Find the plugin and install it. Finally, restart your IDEA. Then everything will be OK!
Solution 3
It is a combination of
-
Ticking the "Enable annotation processing" checkbox in Settings->Compiler->Annotation Processors.
and
Install the plugin of Lombok for idea and restart for change to take effect.
Solution 4
If you are on Mac
, make sure you enable annotation processing (tick the checkbox) at these 2 places.
1.) Intellij IDEA -> Preferences -> Compiler -> Annotation Processors
2.) File -> Other Settings -> Default Settings -> Compiler -> Annotation Processors
And then
3.) Intellij IDEA -> Preferences -> Plugins ->Browse Repositories-> Search for "Lombok"-> install plugin -> Apply and restart IDEA
4.) And then probably restart Intellij IDEA.
This is my IntelliJ IDEA and Mac Version - IntelliJ IDEA 2017.1.5 Build #IU-171.4694.70 --- Mac OS X 10.12
Solution 5
I had both the Lombok plugin installed and Annotation Processing enabled within IntelliJ and my syntax highlighting still wasn't working properly. This could have been due to the 2017 to 2018 IDEA upgrade. I was getting warnings "access exceeds rights" on private fields within classes I had used @Getter and @Setter on.
I had to uninstall the Lombok plugin, restart IntelliJ, then reinstall the plugin, and restart IntelliJ once more.
Everything is working good now.
Related videos on Youtube
Don Quixote
Updated on February 18, 2022Comments
-
Don Quixote about 2 years
I am using IntelliJ IDEA on ubuntu. I added lombok.jar into my project and installed the Lombok plugin for IDEA. I have access to the annotations but the
getters
andsetters
aren't generated. I get the same errors I would get if I tried accessing a getter or setter method that doesn't exist. What could I be missing?-
CodeShadow almost 6 yearsMy answer here: stackoverflow.com/a/42809311/3839716
-
Rishal over 2 yearsAdding one more info which i tried as comment for people looking for answers after every trick they tried. Please invalidate your lib cache->delete .m2 folder and build the project again.
-
-
shafeen over 8 yearsI tried this and it didn't actually solve my problem, are there are options I should be looking at?
-
Jemshit Iskenderov over 8 yearsThis solved, on Android Studio this plugin is needed
-
learner over 6 years"Compiler" option is present under "Build, Execution, Deployment" option on "Settings" Page in intellij 2017 edition.
-
M. Schena over 5 yearsyou sir just finished my 1 hour search of this damn problem
-
Jason Slobotski over 5 yearsHaha! Glad I could help sir.
-
Carrm over 5 yearsSame here, it didn't work after the upgrade to 2018 IDEA. You don't have to reinstall the plugin though. Just go to
Settings > Plugins
, open theUpdates
tab, and you should see an update for Lombok. After Lombok's update and another restart of Intellij, it should work. -
bl4ckr0se over 5 yearsIn a combination of Lombok Plugin.
-
TheFreddyKilo about 5 yearsWoohoo! Had to do this after a new IntelliJ version install. Did not realize lombok was a plugin.
-
Trevor over 3 yearsJust disabling, and then re-enabling and restarting worked for me.
-
Mario Codes over 3 yearsin addition to this, my problem was after doing this 2 steps it needed a
mvn clean install
and then use the buttonMaven
->Reimport All Maven Projects
. -
ihebiheb over 3 yearsSame here after an IntellijJ Update : Had to update Lombok
-
iamfrank over 3 yearsOn
2020.3
, accessing default settings looks like:File -> New Projects Settings -> Preferences for New Projects
. -
badal jain about 3 yearsI had the latest plugin and everything installed, but still intellij was not able to recognize the get and set methods. The build however was working fine. Your answer resolved my issue! Thanks a lot!
-
Gvtha over 2 yearsIn my office, restricted to install plugins. Is there any other way we can add lombok? I have the lombok jar file.