Verric
Verric

Reputation: 1094

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

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

Thanks in advance

Upvotes: 3

Views: 2380

Answers (2)

kwry
kwry

Reputation: 1

I had a similar problem, but it seems to be a bug related to OpenJ9.

The solution was to use the latest edge version, as commented below. https://github.com/rzwitserloot/lombok/issues/2501#issuecomment-664330803

Upvotes: 0

Jay Yanez
Jay Yanez

Reputation: 549

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.

Upvotes: 3

Related Questions