I know there are other similar questions like this, but I have gone through all of them, and none worked for me, hence my asking it here.
I'm using gradle for my project, and when I build, it builds successfully, but when I try to compile using:
/gradlew app:compileJava
I get this error:
Execution failed for task ':app:compileJava'.
> java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in unnamed module ...) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module ...
My dependency for lombok currently looks like this:
dependencies {
annotationProcessor 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
compileOnly 'org.projectlombok:lombok'
testCompileOnly 'org.projectlombok:lombok'
...
}
I have also tried adding a specific version number to the dependences like for example:
annotationProcessor 'org.projectlombok:lombok:1.18.20'
And I was still getting same error.
I'm using jdk 15 (tried using 17, 16 and 11, same error).
When I check my annotation processor in intelliJ, I see there is a processor path with lombok version 1.18.16. I don't know if this might be the issue, but when I delete the cache in .gradle folder, after building, it pops up again. Here is a screenshot.
Please any help would be really appreciated.