Can't compile project when I'm using Lombok under IntelliJ IDEA
For a quick fix to compile your Java project with Lombok in IntelliJ IDEA, make sure the Lombok Plugin is installed via Settings > Plugins. Following that, turn on the annotation processing in Settings > Build, Execution, Deployment > Compiler > Annotation Processors by ticking the Enable annotation processing box.
Detailed procedure
Your problem is most likely due to a few simple but often missed configurations in your IntelliJ IDEA setup for working with Lombok.
Step 1: Set up the environment
Make sure to restart IntelliJ IDEA if prompted after installing the Lombok plugin and setting annotation processing. Rebuild your project afterward.
Step 2: Check the dependencies
The configuration file pom.xml
or build.gradle
should have Lombok included in your project's dependencies. In the case of Gradle, use the semantics of annotationProcessor
to declare Lombok dependencies.
Counter measures
Conflict resolutions
Some IntelliJ plugins can be a party pooper and conflict with Lombok implementation. Pinpoint these nuisances by temporarily disabling other plugins one by one.
Double check your settings
Don't fall for the classic blunder! Global and project-specific settings must both have annotation processing enabled.
Handling persistent issues
Migration to Scala
Scala might be a worthy contender if Lombok refuses to play ball. You gain a feature-rich language and lose the boilerplate you wanted Lombok to help with.
Reach out for help
You're not alone in this! The IntelliJ IDEA community or the official resources are there to help with Lombok-related troubleshooting.
Review project build
Always remember to evaluate your build file (pom.xml
or build.gradle
) for project dependencies and plugin configurations.
Was this article helpful?