Lombok not working with IntelliJ 2020.3 Community Edition

Viewed 32757

I worked with Lombok without any problems until Today, when my Intellij was automatically updated to the latest version 2020.3 30th, November build. After that, any Lombok annotations is not recognised anymore.

My Java project still build from command line with Maven but annotations are completely ignored in the project and cannot run any unit tests manually.

Things I tried so far:

  • Reinstalled the Lombok plugin
  • Restarted Intellij
  • Restarted the laptop
  • Invalidated the cache
  • Re-cloned the project from github
  • Checked that the annotation processor is enabled

Nothing worked. What could have happened? Any idea on what I can try to do?

9 Answers

To summarize go to IntelliJ Preferences (Cmd + ,)

Preferences -> Build, Execution, Deployment -> Compiler

search for this option:

User-local build process VM options (overrides Shared options):

and add this value:

-Djps.track.ap.dependencies=false

My problem was related to my lombok version

Before upgrade my IntelliJ to 2020.03 my lombok version was 1.18.10 and the lombok plugin 0.32-EAP

After upgrade my lombok dependency to 1.18.16 it start work again without any issues. Looks like the plugin is not bundled yet in the community edition.

I don't if is necessary, but my first action was to uninstall the plugin when I read the README on Lombok Plugin repo

I was using Lombok fine with 2020.2 and plugin, but in 2020.3.1 it should be (and it is) included

Lombok plugin bundled, Idea 2020.3

...but I had compilation errors like Cannot resolve symbol 'log' (when using @Slf4j)

I solved the problem deleting .idea from project and opened it again...

edit: it happened to me again today with new checkout (we do not have .idea in Git) and I had similar problem. Not sure if that was a fix, but I checked the plugin (it is not on screenshot above), it started working after, but I built it from cmd (Maven) and tried few other things, so I'm not sure what is a real fix

Seems like lombok is not bundled in Community edition of 2020.3 version. Fix is expected in 2020.3.1 version.

From Lombok plugin GitHub issue

Sorry guys, I have to confirm, it was forgotten to add it properly into the last community build. See bug on Jetbrains Yourtrack: https://youtrack.jetbrains.com/issue/IDEA-257311

The Ultimate 2020.3 version contains lombok plugin as expected per default.

lombok plugin should be included in both IntelliJ distribution (Ultimate and Community) starting with 2020.3 release. Something get wrong, we are working to fix it.

Fix is now planned for IntelliJ Community release 2020.3.1

Update

2020.3.1 Community is released and contains lombok plugin by default now

I managed to make it work on a gradle project (Intellij 2020.3.2) by using exactly this in build.gradle :

annotationProcessor 'org.projectlombok:lombok:1.18.18'
implementation 'org.projectlombok:lombok:1.18.18'

I think important point is to declare it as "annotationProcessor" to include it in the gradle build. I did not even have to mess around with "User-local build process VM options" and even "Enable Annotation Processing" is not ticked in Intellij Settings. So I guess that gradle is taking care of the Lombok generation, and not IDEA. but at least it finally works after hours lost trying to fix IntelliJ.

This is the problem with lombok, whenever IntelliJ provides upgrade lombok starts crying. Same happened with IntelliJ 2020.2

Now there are 2 solutions

  1. Wait till the developers of lombok provide upgrade compatible with IntelliJ 2020.3
  2. Downgrade IntelliJ to previous working version. For me IntelliJ 2020.2 worked perfectly fine.

Installing Lombok plugin and enabling the annotation processor should do the needful. If still issue persists then i think you should report a bug and see what they reply.

Related