IntelliJ IDEA cannot see Lombok generated code [duplicate]
I have a Gradle-based project that uses lombok. I have imported this project into IntelliJ IDEA 14.1 (using the Import External Model import method). I can run the JUnit4 unit tests without problem in Gradle, but IntelliJ seems to have a problem seeing the Lombok generated Getters. This is preventing me from running the tests in IDEA.
To make sure it wasn't a set up issue, I created a Very simple project and confirmed that the same issue occurs in the simple test project.
My versions:
Gradle: gradle-2.3-all via Gradle wrapper
Intellij IDEA: IU-141.713
Lombok Plugin: 0.9.2
What am I missing here?
Update By cannot see I don't mean physically invisible. I mean this:
/home/meeee/workspace/junit-lombok-idea/lib/src/main/java/com/example/jumbokea/Main.java
Error:(10, 11) java: cannot find symbol
symbol: method setIntField(int)
location: variable sc of type com.example.jumbokea.SomeClass
Error:(12, 41) java: cannot find symbol
symbol: method getIntField()
location: variable sc of type com.example.jumbokea.SomeClass
Error:(14, 33) java: constructor AnotherClass in class com.example.jumbokea.AnotherClass cannot be applied to given types;
required: no arguments
found: float,com.example.jumbokea.SomeClass
reason: actual and formal argument lists differ in length
Error:(16, 46) java: cannot find symbol
symbol: method getSomeFloat()
location: variable ac of type com.example.jumbokea.AnotherClass
Error:(17, 43) java: cannot find symbol
symbol: method getSomeClass()
location: variable ac of type com.example.jumbokea.AnotherClass
The decompiled classes show the getters and setters, but I'm getting these errors when I get IntelliJ to run the 'app' or the Unit tests.
You need to enable the annotation preprocessor. See documentation here.
Additionally you should install the lombok plugin if not done already
I managed to solve this issue by doing the following:
- Install the IDEA Lombok plugin
- Enable Annotation Processing see documentation
- Install the Latest Maven on your system and configure IntelliJ to use it (as opposed to the bundled one) see documentation
It can be seen in the build folder.
In my case the issue occurred after updating IntelliJ via Toolbox.
"Enable annotation processing" flag was switched off (despite importing the settings from previous IntelliJ version), so I switched it on. This did not resolve the issue after restart, clean, build.
However, resintalling the lombok plugin helped!
EDIT: Seems that it was the problem with compatibility of lombok plugin with IntelliJ 2018.1, plugin upgrade to 0.17 is required for IntelliJ users.
Lombok plugin changelog excerpt:
Lombok support plugin updated to v0.17: - Fixed (#465): Fix plugin compatibility with IntelliJ 2018.1