Adlet
Adlet

Reputation: 25

Lombok classes not generated

I’m using Intellij IDEA Community Edition (the latest version: Build #IC-242.23339.11, built on September 25, 2024)

here is my build.gradle file:

plugins {
    id 'java'
    id 'org.springframework.boot' version '3.3.4'
    id 'io.spring.dependency-management' version '1.1.6'
}

group = 'org.example'
version = '0.0.1-SNAPSHOT'

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(17)
    }
}

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'
    testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

tasks.named('test') {
    useJUnit()
} 

gradle-wrapper.properties:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists 

entity class:

@Builder
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class Test {
    private Long id;
    private String name;
    private int yearOfBirth;
    private String phoneNumber;
    private String secondaryPhoneNumber;
    private LocalDate createdAt;
} 

the java version is: 17.0.12

I’m not doing anything crazy. I just need Lombok to properly generate the Builder class for me but whenever i run

.\gradlew clean build

or

.\gradlew compileJava

then nothing is being generated in build/generated/sources/annotationProcessor/java/main

marking “Enable annotation processing” as checked in the IDEA settings doesnt resolve this issue I also tried to play with different lombok and gradle versions but the issue is still there Invalidating caches did not help either

What am i missing? I’d appreciate the help, thanks in advance!

Upvotes: 0

Views: 240

Answers (2)

kasptom
kasptom

Reputation: 2458

I've created the similar project and found the Test.class file in the path similar to build/classes/java/main/org/example/.../Test.class

You can also use the RMB (Context menu) -> Refactor -> Delombok

Upvotes: 1

Tobias Horst
Tobias Horst

Reputation: 279

As stated on the lombok setup page for IntelliJ the plugin needs to be added to the IDE for versions after 2023.1.

Upvotes: 1

Related Questions