Lombok added but getters and setters not recognized in Intellij IDEA

163,678

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.

Share:
163,678

Related videos on Youtube

Don Quixote
Author by

Don Quixote

Updated on February 18, 2022

Comments

  • Don Quixote
    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 and setters 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
      CodeShadow almost 6 years
    • Rishal
      Rishal over 2 years
      Adding 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
    shafeen over 8 years
    I tried this and it didn't actually solve my problem, are there are options I should be looking at?
  • Jemshit Iskenderov
    Jemshit Iskenderov over 8 years
    This solved, on Android Studio this plugin is needed
  • learner
    learner over 6 years
    "Compiler" option is present under "Build, Execution, Deployment" option on "Settings" Page in intellij 2017 edition.
  • M. Schena
    M. Schena over 5 years
    you sir just finished my 1 hour search of this damn problem
  • Jason Slobotski
    Jason Slobotski over 5 years
    Haha! Glad I could help sir.
  • Carrm
    Carrm over 5 years
    Same 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 the Updates tab, and you should see an update for Lombok. After Lombok's update and another restart of Intellij, it should work.
  • bl4ckr0se
    bl4ckr0se over 5 years
    In a combination of Lombok Plugin.
  • TheFreddyKilo
    TheFreddyKilo about 5 years
    Woohoo! Had to do this after a new IntelliJ version install. Did not realize lombok was a plugin.
  • Trevor
    Trevor over 3 years
    Just disabling, and then re-enabling and restarting worked for me.
  • Mario Codes
    Mario Codes over 3 years
    in addition to this, my problem was after doing this 2 steps it needed a mvn clean install and then use the button Maven -> Reimport All Maven Projects.
  • ihebiheb
    ihebiheb over 3 years
    Same here after an IntellijJ Update : Had to update Lombok
  • iamfrank
    iamfrank over 3 years
    On 2020.3, accessing default settings looks like: File -> New Projects Settings -> Preferences for New Projects.
  • badal jain
    badal jain about 3 years
    I 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
    Gvtha over 2 years
    In my office, restricted to install plugins. Is there any other way we can add lombok? I have the lombok jar file.