lombok annotation is not wokring in intellij

800 views java
6

It's seem lombok annotation is not working.

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor

public class HelloResponseDto {
    private final String name;
    private final int amount;
}

and here is output

> Task :cleanTest UP-TO-DATE
> Task :compileJava FAILED
C:\Users\tahun\IdeaProjects\spring-tutorial\src\main\java\org\example\springboot\web\dto\HelloResponseDto.java:10: error: variable name not initialized in the default constructor
    private final String name;
                         ^
C:\Users\tahun\IdeaProjects\spring-tutorial\src\main\java\org\example\springboot\web\dto\HelloResponseDto.java:11: error: variable amount not initialized in the default constructor
    private final int amount;

I'm working with Intellij so I also checked Settings > Compiler > Annotation Processors > Enable annotaion processing

and i also add compile('org.projectlombok:lombok') in my build.gradle

Is there any solutions?

answered question
Add a Comment

3 Answers

5
Channa 0 Comments

You need to install lombok plugin to Intellij. You can use following url to download.

Lombok Plugin

posted this
6

Install the needed plugin for Lombok...

Lombok is not supported out of the box.

posted this
13
Ambuj 0 Comments

You can add the lombok plugin - https://plugins.jetbrains.com/plugin/6317-lombok/

Go to Setting --> plugins and search for lombok and add the plugin.

Restart and check. IntelliJ should not report any error of lombok.

posted this

Please login first before posting an answer.