Adding Lombok plugin to IntelliJ project [duplicat

2020-02-23 05:18发布

I'm trying to add Lombok to my Spring Boot project in IntelliJ IDEA. So far, I've

  1. added the plugin under Settings - Plugins (version 0.13.16)

  2. added compile('org.projectlombok:lombok') to my Gradle dependencies

  3. enabled annotation processing

It still doesn't recognize either the Lombok import or the annotations.

What am I missing?

Solved:

I had to run an update on my Gradle file.

10条回答
倾城 Initia
2楼-- · 2020-02-23 05:31

I just found how.

I delete the first occurrence of lombok @Slf4j or log where the compiler complains, and wait for the warning(the red bubble) of IDEA, suggesting "add the lombok.extern.Slf4j.jar to classpath". Since then all goes well. It seems IDEA likes to complain about lombok.

查看更多
贪生不怕死
3楼-- · 2020-02-23 05:33

To add the Lombok IntelliJ plugin to add lombok support IntelliJ:

  • Go to File > Settings > Plugins
  • Click on Browse repositories...
  • Search for Lombok Plugin
  • Click on Install plugin
  • Restart IntelliJ IDEA
查看更多
The star\"
4楼-- · 2020-02-23 05:34

I had the same problem after updating IntelliJ IDE, the fix was: delete existed plugin lombok and install it again (the newest version),

查看更多
何必那么认真
5楼-- · 2020-02-23 05:35

If after installing the lombok intellij plugin and enabling annotation processing, if your getter and setters are still not recognised in intellij, do check if the plugin version is compatible with the intellij version you use.

It is listed under the Downloads section:

查看更多
相关推荐>>
6楼-- · 2020-02-23 05:38

There is a lot of really helpful info posted here, but there is one thing that all the posts seem to have wrong. I could not find any 'Settings' option under 'Files', and I hunted around for 10 minutes looking through all the menus until I found the settings under 'IntelliJ IDE' -> 'Preferences'.

I don't know if I am using a differing OS version or IntelliJ version from other posters, or if it is because I am a stupid Windows user that doesn't know that settings == preferences on a mac (Did I miss the memo?), but I hope this helps you if you aren't finding the paths that other posts are suggesting.

查看更多
劫难
7楼-- · 2020-02-23 05:39

Be sure to activate the plugin for the project in the Intellij settings.

  1. Click Settings
查看更多
登录 后发表回答