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.
error: cannot find symbol
String name = user.getName();
^
symbol: method getName()
location: variable user of type UserCommon 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.
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.
<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.
# remove any -proc:none from compilerArgs / options.compilerArgsHow to prevent it
- Always pair Lombok
compileOnlywithannotationProcessorin every module. - Never set
-proc:noneon modules that use Lombok. - Cover compilation in CI so missing accessors fail there, not just in the IDE.