Lombok added but getters and setters not recognize

2019-01-21 04:23发布

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?

10条回答
唯我独甜
2楼-- · 2019-01-21 05:06

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.

查看更多
对你真心纯属浪费
3楼-- · 2019-01-21 05:13

I fixed it by following steps:

  1. Installed previous version of Idea(12.16) and start it(idea 13 was launched)
  2. then i switch on window with idea 13 (it proposed to reread some config files. I agreed and restart my IDE). And then everithing became ok with tha latest version of IDEA
查看更多
Explosion°爆炸
4楼-- · 2019-01-21 05:14

In my case it was migrating from idea 2017 to 2018 and Lombok plugin was already there. All I did is added "Enable annotation processing options" entering preferences and check the box

查看更多
欢心
5楼-- · 2019-01-21 05:15

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.

查看更多
登录 后发表回答