Lombok: IntelliJ does not see Lombok annotations

Created on 27 Mar 2016  路  6Comments  路  Source: projectlombok/lombok

I've just installed newest Lombok (0.10.16) in IntelliJ and it doesn't see any annotations. I've checked "Settings > Compiler > Annotations Processors" and "Enable annotation processing" is checked.

Lombok is aslo enabled in settings.

alt tag

IntelliJ version: 2016.1
JRE version: 1.8.0_77-b03

Most helpful comment

Well it's actually not so weird. IDE integration does not provide Lombok itself. It needs to be on classpath for compiler to understand it, while IntelliJ recognizes Lombok types and annotations for auto complete support etc. Two separate things.

It works in similar way in Eclipse

All 6 comments

IntelliJ support is provided by https://github.com/mplushnikov/lombok-intellij-plugin and not lombok itself. The plugin works as expected there for me and the author has done a lot of really good improvements to IntelliJ support in the last days.

This project is Lombok itself and is used by the plugin.

@MajewskiKrzysztof I can't see any import lombok.Data in your screenshot. Either you cut it off as unimportant or you forgot it. I don't know how it exactly works in IntelliJ, but in Eclipse, you need three things:

  • install lombok
  • add it to the build path, just like any other JAR you want to depend on
  • import the annotation (can be done via autocomplete)

Thank for answers!

@AlexejK I've installed it from github.

@Maaartinus I cannot import this library. I get this error: "Error:(1, 14) java: package lombok does not exist". I''ve also tried to addp lombok's .zip file to my project dependencies and it still doesn't work :/

So you need Lombok itself as dependency. Either via Gradle or Maven is easiest but you can also add it as manual dependency. If adding manually you have to set up dependency path in intellij to point to the jar of Lombok.

The plugin you can install via intellij plugin installer, select browse repos and search for Lombok. It will be the one I gave you link for before but ensures correct package (and released version)

@AlexejK thank a lot! Adding a gradle dependency helped. But i am wondering why it didn't work with the plugin...

Well it's actually not so weird. IDE integration does not provide Lombok itself. It needs to be on classpath for compiler to understand it, while IntelliJ recognizes Lombok types and annotations for auto complete support etc. Two separate things.

It works in similar way in Eclipse

Was this page helpful?
0 / 5 - 0 ratings