Skip to content
Latchkey

Lombok "cannot find symbol" for getters/setters - Fix Annotation Processing in CI

The compiler could not find Lombok-generated members (getX(), builder(), the all-args constructor). Lombok generates them during annotation processing; if processing is disabled or Lombok is not registered as a processor, the methods never get created and every call site fails to compile.

What this error means

Compilation fails with cannot find symbol: method getName() (or builder(), setX()) on classes annotated @Data/@Getter/@Builder. The annotation is present but its output is missing.

java
error: cannot find symbol
    String name = user.getName();
                      ^
  symbol:   method getName()
  location: variable user of type User

Common causes

Lombok not on the annotationProcessor path

Lombok is declared as implementation/compileOnly only; without annotationProcessor, modern Gradle/Maven does not run it.

Annotation processing disabled

A -proc:none flag, or a build that turned off processing, prevents Lombok from generating anything.

IDE compiled but CI did not

The IDE has the Lombok plugin so it "works locally," while the CI compiler has no processor configured.

How to fix it

Register Lombok as a processor (Gradle)

Declare both the API (compileOnly) and the processor.

gradle
dependencies {
  compileOnly 'org.projectlombok:lombok:1.18.34'
  annotationProcessor 'org.projectlombok:lombok:1.18.34'
  testCompileOnly 'org.projectlombok:lombok:1.18.34'
  testAnnotationProcessor 'org.projectlombok:lombok:1.18.34'
}

Register Lombok as a processor (Maven)

Add Lombok to the compiler plugin annotationProcessorPaths.

pom.xml
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <configuration>
    <annotationProcessorPaths>
      <path><groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId><version>1.18.34</version></path>
    </annotationProcessorPaths>
  </configuration>
</plugin>

Do not disable annotation processing

Ensure no -proc:none is passed to javac in the build.

Terminal
# remove any -proc:none from compilerArgs / options.compilerArgs

How to prevent it

  • Always pair Lombok compileOnly with annotationProcessor in every module.
  • Never set -proc:none on modules that use Lombok.
  • Cover compilation in CI so missing accessors fail there, not just in the IDE.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →