The build fails inside Lombok's annotation processor after a JDK upgrade
Fatal error compiling: java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessorShort answer
Lombok reaches into the compiler, so each new JDK needs a Lombok release that supports it. If your build image moved to a newer JDK and Lombok stayed put, javac fails inside LombokProcessor. Upgrade Lombok to a release that lists your JDK, and on JDK 23 and later declare Lombok as an annotation processor in Maven.
Fix it fast
1Find out which cause you have
Print the JDK that Maven actually compiles with and the Lombok version it resolves. A mismatch between the two is the usual story: the CI image changed its JDK without anyone touching the pom.
mvn -version mvn dependency:tree -Dincludes=org.projectlombok2Match what you see, then jump to its fix
What does the error look like?
Fatal error compiling: java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor
Cause 1 of 2
The Lombok version is older than the JDK
1Check
Compare your Lombok version with the first release that supports your JDK: 1.18.20 for JDK 16, 1.18.22 for JDK 17, 1.18.30 for JDK 21, 1.18.32 for JDK 22, 1.18.36 for JDK 23, 1.18.38 for JDK 24, 1.18.40 for JDK 25.
mvn dependency:tree -Dincludes=org.projectlombok2Fix
Raise Lombok to a release at or above the one for your JDK. Alternatively pin the build image back to the JDK your Lombok supports.
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.40</version>
<scope>provided</scope>
</dependency>3Verify
Run a clean build.
mvn -q clean compileConfirmed by projectlombok.org
Cause 2 of 2
On JDK 23 and later, Lombok is not declared as an annotation processor
1Check
Look for an annotationProcessorPaths block in the maven-compiler-plugin configuration. Lombok's own setup page says the entry is mandatory from JDK 23 (and from JDK 9 when compiling as modules).
grep -n -A8 "annotationProcessorPaths" pom.xml2Fix
Add Lombok to the compiler plugin's annotationProcessorPaths and keep its version equal to the dependency's version.
<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.40</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>3Verify
Rebuild from a clean state.
mvn -q clean verifyConfirmed by projectlombok.org
How do I stop it coming back?
- Pin the JDK in the CI image (a version tag, not 'latest') so it moves only when you decide.
- Read the Lombok changelog before raising the JDK of a project.
- Keep the dependency version and the annotationProcessorPaths version in one Maven property.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Related fixes
Back end
Android gets HTML instead of JSON from a PHP API
org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
The response body is not JSON.
2 causes, each with a fixBack end
The AWS SDK for Java cannot find credentials, and AwsCredentials.properties does nothing
software.amazon.awssdk.core.exception.SdkClientException: Unable to load credentials from any of the providers in the chain
AwsCredentials.properties on the classpath is an old convention: the default provider chain of the AWS SDK for Java does not read it.
4 causes, each with a fixBack end
Gradle runs no Cucumber scenarios from my feature files
Feature files exist under src/test but nothing runs
Cucumber runs on the JUnit Platform, so Gradle must call useJUnitPlatform() and have the cucumber-junit-platform-engine on the test classpath.
4 causes, each with a fixBack end
A Gradle build fails on classes that use Lombok annotations
Error: Annotation processors must be explicitly declared now.
Lombok is two things for Gradle: a compile-time library and an annotation processor.
3 causes, each with a fixBack end
Gradle 8 fails on Report destination: switch to outputLocation
What went wrong: 'java.io.File org.gradle.api.reporting.ConfigurableReport.getDestination()'
Gradle 8.0 removed the deprecated destination and enabled properties of the Report type.
2 causes, each with a fixBack end
Apache HttpClient 5 has no setSSLSocketFactory on HttpClients.custom()
HttpClients.custom().setSSLSocketFactory() method not found
In Apache HttpClient 5 the TLS setup no longer sits on the client builder.
2 causes, each with a fix