Introduction
If you are a Java or Spring Boot developer, you have probably faced this situation.
You add Lombok annotations like:
@Getter
@Setter
@Data
But suddenly your IDE shows errors like:
The method getName() is undefined for the type User
or
Cannot find symbol: method getId()
Even though your project compiles successfully.
This is one of the most common Lombok issues in Eclipse / Spring Tool Suite (STS).
In this article, we'll understand:
Why Lombok stops working
The most common causes
How to fix it in 3 simple steps
The Problem
Consider this class:
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class User {
private String name;
private int age;
}
Now in another class:
User user = new User();
user.setName("John");
System.out.println(user.getName());
But Eclipse shows an error:
The method getName() is undefined for the type User
Why?
Because Eclipse is not processing Lombok annotations.
Why This Happens
Lombok works using Annotation Processing.
During compilation Lombok generates methods automatically like:
getName()
setName()
toString()
equals()
hashCode()
But if annotation processing is disabled, Eclipse cannot generate them.
Lombok Internals (Infographic)
Java Class
│
▼
Lombok Annotation
│
▼
Annotation Processor
│
▼
Generated Methods
(getters/setters)
│
▼
Compiled Class
Without annotation processing:
Annotations ignored → Methods not generated → IDE error
Step 1 — Enable Annotation Processing
In Eclipse or STS:
Window
→ Preferences
→ Java
→ Compiler
→ Annotation Processing
Enable:
☑ Enable annotation processing
Apply and restart the IDE.
Step 2 — Install Lombok in Eclipse
Download Lombok from:
https://projectlombok.org/download
Run:
java -jar lombok.jar
Then select your Eclipse / STS installation directory.
Lombok will modify the IDE configuration.
Restart Eclipse.
Step 3 — Add Lombok Dependency
If you're using Maven, add:
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.32</version>
<scope>provided</scope>
</dependency>
If using Gradle:
compileOnly 'org.projectlombok:lombok:1.18.32'
annotationProcessor 'org.projectlombok:lombok:1.18.32'
Final Result
Your class:
@Data
public class User {
private String name;
private int age;
}
Lombok automatically generates:
getName()
setName()
getAge()
setAge()
toString()
equals()
hashCode()
No more IDE errors.
Quick Troubleshooting Checklist
If Lombok still doesn't work:
✔ Annotation processing enabled
✔ Lombok installed in IDE
✔ Dependency added in pom.xml
✔ Project cleaned and rebuilt
✔ IDE restarted
Pro Tip
Many developers think Lombok is broken when the issue is actually IDE configuration.
Once annotation processing is enabled, Lombok works perfectly.
Summary
Lombok errors in Eclipse usually happen because:
Annotation Processing Disabled
IDE not configured for Lombok
Missing dependency
Fixing these takes less than 2 minutes.
Java Backend Debugging Series
This article is part of the Java Backend Debugging Series.
Next article:


Top comments (0)