18

I have tried using Lombok on Intellij IDEA 13 Ultimate. However. I get the famous error "cannot find symbol" for all the methods that should have been available when I am using specific annotations for example the once I use as annotations are @Builder, @AllArgsConstructor and @Data.

I have already set my compiler to enable annotation processing and I have looked deeply into it, but with no solution of how to solve it.

Any advice or tips would be nice.

yole
  • 92,896
  • 20
  • 260
  • 197
Khiem-Kim Ho Xuan
  • 1,301
  • 1
  • 22
  • 45

8 Answers8

11

Kind of old question here, but I came across the same problem today. I had to do two things to make it work:

  1. Set annotation processing on: Settings -> Compiler -> Annotation Processors
  2. Change from ajc to javac for the project: Compiler -> Java Compiler

you of course also need the Lombok plugin.

Vegard
  • 1,802
  • 2
  • 21
  • 34
5

In my case non of methods works. But I found solution for my case. I needed to add to my Gradle dependencies list of

dependencies {
    compileOnly 'org.projectlombok:lombok:1.18.22'
}

one more line

dependencies {
    compileOnly 'org.projectlombok:lombok:1.18.22'
    annotationProcessor 'org.projectlombok:lombok:1.18.22'
}

With such combination you even don't need enabling Annotation Processors from @Vegard answer.

Mike Menko
  • 819
  • 8
  • 9
3

In my case apart from enabling Annotation Processing and installing Lombok Plugin I had to rebuild project by Build -> Rebuild Project

komidawi
  • 386
  • 3
  • 8
3

I have the same problem. Using maven, after I add at to my pom.xml annotationProcessor nothing changed. Also I'm installed Lombok plugin at Intelij IDEA.

<annotationProcessorPaths>
    <path>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.18.20</version>
    </path>
</annotationProcessorPaths>
howgenius
  • 31
  • 3
  • Gracias, I won it's troubble with replaced my project at Default in Settings -> Build -> Annotation Processors and it works. Thanks! – howgenius Aug 24 '22 at 13:13
1

I was having a similar issue, but resolved it by upgrading to IDEA 15.0.2 and Lombok plugin 0.9.6.14. I had to restart IDEA several times before all of the getters/setters generated by Lombok were resolved.

I also found this related answer, but it didn't seem to help my problem. It may help you if upgrading does not.

Community
  • 1
  • 1
dugsmith
  • 119
  • 3
  • 9
1

Tried with the @Mike's solution above, and it works. For your information, even though I enabled the Annotation Processors , but it seems like not working. After I added the annotationProcessor 'org.projectlombok:lombok:1.18.22' it was built successfully.

Jack.Li
  • 11
  • 1
0

If you use intellij Idea go to setting and add Lombok plugin to your intellij idea

enter image description here

0

I solved this in my Gradle project by including the Lombok plugin. No dependencies or annotationProcessor needed (nor did those work for me).

For example in your build.gradle.kts:

plugins {
    id("io.freefair.lombok") version "6.5.1"
}

https://plugins.gradle.org/plugin/io.freefair.lombok

Caranown
  • 173
  • 9