Lombok not working with IntelliJ 2020.3 Community Edition

28,756

Solution 1

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

Solution 2

A work around is here, until they fix the actual problem:

https://youtrack.jetbrains.com/issue/IDEA-250718#focus=Comments-27-4418347.0-0

(see screenshoot for IJ fix)

Solution 3

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

Solution 4

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

Solution 5

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.

Share:
28,756

Related videos on Youtube

user1883212
Author by

user1883212

Updated on February 25, 2021

Comments

  • user1883212
    user1883212 about 3 years

    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?

  • Loïc
    Loïc over 3 years
    This fixed the same issue I have. The issue you linked appears to be fixed in 2020.3, do you known if there is a regression?
  • user1883212
    user1883212 over 3 years
    Not sure about that... but the link shows this is fixed in the build 203.4267. However my build is 203.5981.155 and the bug is still there. IJ only works with the work around.
  • Andrey
    Andrey over 3 years
    This actually should be fixed in the last IDE and Lombok plugin versions and there should be no need to set the -Djps.track.ap.dependencies=false option. Could you please tell what exact Lombok plugin versions do you use in 2020.3 when it does not work if you do not set this option manually? Thanks.
  • firoj_mujawar
    firoj_mujawar over 3 years
    I was in impression that this will be an accepted Answer, but people who got more points already on StackOverflow are using those points just to down-vote the answers. For me this solution worked, that's why I shared. You can take this as a workaround till actual solution from lombok. But you guys want to invest your time in down-voting then happy investing.
  • sfitts
    sfitts over 3 years
    @Andrey -- is there a release of the Lombok plug-in for 2020.3 -- looking on the Github site, I don't see one (last release is 0.33-2020.2). The JetBrains marketplace shows the same thing (last release on Oct 28).
  • Andrey
    Andrey over 3 years
    The plugin is bundled with IntelliJ IDEA now. So after update the plugin should be also updated.To check you have the latest version you can via Help | Check For Updates action.
  • Rogério Ramos
    Rogério Ramos over 3 years
    IntelliJ IDEA 2020.3 (Community Edition) Build #IC-203.5981.155, built on November 30, 2020 Runtime version: 11.0.9+11-b1145.21 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Linux 5.8.18-1-manjaro GC: ParNew, ConcurrentMarkSweep Memory: 1892M Cores: 8 Non-Bundled Plugins: google-java-format, Lombook Plugin Current Desktop: GNOME
  • CrazyCoder
    CrazyCoder over 3 years
    It's indeed a bug in Lombok and it was fixed some time ago, so the solution is to update to the current Lombok version. Please also don't mix it up with the Lombok IntelliJ IDEA plug-in. You update Lombok dependency itself, not the plug-in: github.com/rzwitserloot/lombok/issues/2592. See also this comment.
  • CrazyCoder
    CrazyCoder over 3 years
    It's indeed a bug in Lombok and it was fixed some time ago, so the solution is to update to the current Lombok version. You update Lombok dependency itself, not the plug-in: github.com/rzwitserloot/lombok/issues/2592. See also this comment.
  • CrazyCoder
    CrazyCoder over 3 years
    The proper solution is to update Lombok dependency: github.com/mplushnikov/lombok-intellij-plugin/issues/….
  • firoj_mujawar
    firoj_mujawar over 3 years
    I would never in my understanding ever mix-up any IDEA plugin and maven dependency. I was of-course talking about the plugin in the above answer.
  • CrazyCoder
    CrazyCoder over 3 years
    If you were talking about the plug-in, your answer is wrong. The fix is to update the dependency version. Lombok plug-in author now works for JetBrains and Lombok plug-in is bundled with IntelliJ IDEA, so you don't need to install it separately or update it manually like before. It will be always compatible with the current IDE version from now on. This issue cannot be fixed by the plug-in update.
  • firoj_mujawar
    firoj_mujawar over 3 years
    Are you saying, updating Lombok maven dependency version will update the Lombok IntelliJ plugin or it automatically make plugin to work as it was previously? If this is the case, then I am wondering how it is working for me for IntelliJ 2019 and not working for IntelliJ 2020.3!
  • CrazyCoder
    CrazyCoder over 3 years
    No. These two are unrelated.
  • firoj_mujawar
    firoj_mujawar over 3 years
    Never mind my answer was a quick workaround. As far as I know, Lombok plugin is not compatible for IntelliJ 2020.3 as of now. Check compatibility here: plugins.jetbrains.com/plugin/6317-lombok/versions The latest version is 0.33 which is compatible with only IntelliJ 2020.2.X
  • CrazyCoder
    CrazyCoder over 3 years
    See my comments above. Lombok plug-in is now bundled with IntelliJ IDEA. Repository plug-in version is currently older than the one that comes with IntelliJ IDEA Ultimate download.
  • firoj_mujawar
    firoj_mujawar over 3 years
    I'm sorry, how do you know this? any docs reference please? If your claim is right then it should work, right?
  • firoj_mujawar
    firoj_mujawar over 3 years
    Ok I got this. github.com/mplushnikov/lombok-intellij-plugin But bro it is still not working, only the above workaround worked for me, let me try this today.
  • CrazyCoder
    CrazyCoder over 3 years
    I work for JetBrains. You can download and install 2020.3 Ultimate from jetbrains.com/idea/download/index.html and check it yourself. IntelliJ IDEA Community 2020.3 doesn't bundle Lombok yet, but it's a know issue with the fix planned for 2020.3.1 update.
  • Searene
    Searene about 3 years
    I also need to run Rebuild instead of Build to make it work.