Gradle build fails on Lombok annotated classes

I had the same problem and worked for me when added to build.gradle:

dependencies{

compileOnly 'org.projectlombok:lombok:1.18.8'
annotationProcessor 'org.projectlombok:lombok:1.18.8'

}

Resource: https://projectlombok.org/setup/gradle


You will need to specify lombok as an annotation processor. To do this, You will need to add following to build.gradle in a Jhipster project.

apply plugin: 'net.ltgt.apt'

dependencies {    
    provided "org.projectlombok:lombok:$lombokVersion"
    apt "org.projectlombok:lombok:$lombokVersion"

    /** ... */
}

Jhipster uses net.ltgt.gradle:gradle-apt-plugin for annotation processing.

For IntelliJ setup, Enable annotation Processing should be checked.

More Info: Project Lombok - android instructions


For new users, consider using gradle plugin:

plugins {
  id "io.freefair.lombok" version "5.3.3.3"
}

Then you don't need compileOnly or annotationProcessor

Reference: https://plugins.gradle.org/plugin/io.freefair.lombok