Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle can not build with lombok

Currently can not build a new project with Gradle and Lombok.

warning: You aren't using a compiler supported by lombok, so lombok will not work and has been disabled.
  Your processor is: org.gradle.api.internal.tasks.compile.processing.IncrementalProcessingEnvironment
  Lombok supports: sun/apple javac 1.6, ECJ
/Users/rich/Desktop/reports/src/main/java/com/example/reports/reportparamters/ReportParameter.java:46: error: cannot find symbol
        filter.setReportParameter(this);

I know this was a common issues with older versions of gradle and lombok and have seen similar questions on this site, however I'm using more recent version and could not get passed this issue

Environment info

  • Java: openjdk 13.0.1 2019-10-15 (This is the OpenJ9 version and NOT the HotSpot version)
  • Javac: 13.01
  • Gradle: 6.0.1
  • Lombok: 1.18.10

Build.gradle (Built using Spring initialiser)

plugins {
    id 'org.springframework.boot' version '2.2.4.RELEASE'
    id 'io.spring.dependency-management' version '1.0.9.RELEASE'
    id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '13'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    compileOnly 'org.projectlombok:lombok'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
}

Things I've tried

  • I've tried swapping out deps for the Lombok gradle plugin, as stated here :
  • Nearly all other similar issues on stack overflow simply referred to updating Gradle to a version 4.5+ and a Lombok version of 1.18+

Thanks in advance

like image 899
Verric Avatar asked Nov 21 '25 15:11

Verric


1 Answers

I'm having the same issue right now with OpenJ9 13.0.1.9, but it works fine with Zulu Java 13 (zulu13.29.9-ca-jdk13.0.2-win_x64).

So, I'm using Zulu when building with Gradle (6.0.1), and Open J9 to run my executable JAR.

like image 180
Jay Yanez Avatar answered Nov 23 '25 05:11

Jay Yanez