๐ด The Error You're Seeing
Confirm this matches your console output. If it does, you're in the right place.
[ERROR] COMPILATION ERROR :
[ERROR] /path/to/MyClass.java:[10,8] No processor claimed any of the following annotations: lombok.Data, lombok.Builderโก Quick Fix Works 80% of the time
Add Lombok to the annotationProcessorPaths in your maven-compiler-plugin configuration.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>๐ง Why this Happens
Tap to expand the deep technical explanation
In Java 17+, the Maven compiler strictly isolates annotation processors from standard compile dependencies. Even if `lombok` is in your `pom.xml`, Maven ignores it during compilation unless you explicitly declare it inside the `<annotationProcessorPaths>` block of the `maven-compiler-plugin`.
The HITEC City Parking Spot Analogy:
It's like hiring a chef (Lombok) to cook a meal, but forgetting to give them access to the kitchen (annotationProcessorPaths). The manager (Maven) sees ingredients (annotations) but no chef to process them, so it throws an error.
๐ How to Reproduce Confirm this is your error
Add `@Data` to a Java class. Add Lombok as a standard dependency in `pom.xml`. Run `mvn clean compile` using Java 17+.
๐ ๏ธ Solutions (5 Ways to Fix)
Configure annotationProcessorPaths in pom.xml
๐ Use this when building with Maven and Java 17+.
Explicitly tell Maven that Lombok is an annotation processor, not just a library.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
</path>
<!-- Add MapStruct here too if using it -->
</annotationProcessorPaths>
</configuration>
</plugin>Enable Annotation Processing in IntelliJ
๐ Use this if Maven build works, but IntelliJ shows red errors.
IntelliJ has its own compiler. You must manually enable annotation processing in the IDE settings.
// IntelliJ Settings -> Build, Execution, Deployment -> Compiler -> Annotation Processors
// Check 'Enable annotation processing'Install the Lombok Plugin
๐ Use this if you are on an older IntelliJ version that doesn't bundle Lombok.
Modern IntelliJ has Lombok built-in, but older versions require a plugin to understand the annotations.
// IntelliJ Settings -> Plugins -> Search 'Lombok' -> Install -> Restart IDEEnsure Lombok dependency is not marked as 'provided'
๐ Use this if you see compile errors in the IDE but not in Maven.
Sometimes IDEs fail to index provided scopes. Change to compile scope temporarily to force the IDE to index it, or rely strictly on Maven builds.
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope> <!-- This is standard, but IDE needs plugin -->
</dependency>Invalidate Caches and Restart
๐ Use this if everything is configured but the IDE is still stuck.
Sometimes IntelliJ's internal cache gets corrupted and fails to see the Lombok plugin.
// File -> Invalidate Caches... -> Check all boxes -> Invalidate and Restart๐ Version Notes
Lombok sometimes worked without explicit annotationProcessorPaths in older Maven versions.
Strictly requires explicit annotationProcessorPaths configuration for Java 17+.
๐ก๏ธ How to Prevent This Next Time
Always use Spring Initializr to generate your Spring Boot projects, as it correctly configures the Lombok annotation processor paths automatically.