Igor
Igor

Reputation: 1464

What do I need in order to have lombok recognize @Data annotation on IntelliJ?

I was developing a project using Springboot Eclipse STS on windows. I then started using IntelliJ in a linux environment (Pop OS) and I'm having some issues with Lombok.

I don't get any compilation issue, but when I try to run the project I get errors like this:

java: cannot find symbol symbol: method getEmail() location: variable request of type ca.where2go.api.request.CreateAccountRequest

If I replace the @Data to @Getter and @Setter I dont get any error when trying to run regarding lombok, but I do get another error saying:

/home/schkrab/Development/git/where2go/src/test/java/ca/where2go/api/Where2GoApplicationTests.java:14:24 java: package org.junit.runner does not exist

I then had to manually import Junit4 to the library...

And again, when I try to run I get an error saying:

/home/schkrab/Development/git/where2go/src/test/java/ca/where2go/api/Where2GoApplicationTests.java:178:26 java: cannot find symbol symbol: method of(java.lang.String) location: interface java.nio.file.Path

I had to replace my Path.of to Paths.get

When I apply all these changes, I get my project up and running.

But I think those issues clearly indicates there is something wrong with my environment.

Is there anything specific I need to do in order to be able to use @Data annotation on IntelliJ / Linux?

Upvotes: 0

Views: 209

Answers (1)

scifispacedrive
scifispacedrive

Reputation: 65

If you are using maven then you should include lombok as a 'provided' dependency, add it to your block like so:

<dependencies>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.18.20</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

More details here -

https://projectlombok.org/setup/maven,

https://projectlombok.org/setup/intellij

Upvotes: 1

Related Questions