Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lombok does not work for Eclipse Neon

Tags:

I downloaded lombok.jar (lombok-1.16.14.jar) put it into my Downloads. Then I clicked on this jar, the execution correctly identifies the Eclipse instances on my MacOS and then I selected the instance I want. Lombok is also specified in the pom.xml org.projectlombok lombok 1.16.14 provided

In eclipse.ini I got the addition: -javaagent:../Eclipse/lombok.jar

lombok.jar was added to the same directory as eclise.ini /Applications/Eclipse.app/Contents/Eclipse

I am still getting setter/getter errors in Eclipse Problems despite that my mvn build works fine.

The code for a User:

@Entity @Getter @Setter @NoArgsConstructor @AllArgsConstructor @EntityListeners(UserListener.class) public class User implements Serializable, UserDetails { ... 

The error:

The method getRole() is undefined for the type User  
like image 967
Alex Avatar asked Feb 24 '17 17:02

Alex


People also ask

Why Lombok is not working in eclipse?

Eclipse 2020-12 (Eclipse 2020-12 Java) does not support Lombok. It runs fine, but the IDE shows errors for all Lombok generates getters/setters. The previous version of Eclipse work fine. You have to install lombok on your installation, otherwise Eclipse will not be able to handle the Lombok-Annotations.

Does eclipse support Lombok?

Via eclipse plugin installerYou can install lombok directly from within eclipse, and in that way, you can also include lombok as part of your team eclipse deployment configuration.


1 Answers

Since you have already added the .jar to your lib folder, then go to the lib and execute java -jar lombok-1.16.4.jar, you'll see a wizard, specify the location of your eclipse.ini, after you are done with this your eclipse.ini file should look like this:

    -vmargs     ...     -javaagent:lombok.jar     -Xbootclasspath/a:lombok.jar 

For me this just worked fine but I found in other answers that:

  • You should not just "restart" Eclipse, go to File -> Exit and then open it again. taken from here
  • Don't forget to do a mvn clean just to make sure that you recompiled your classes. taken from here
  • After all this you should also right-click on your project, then Maven -> Update Project taken from here
like image 54
imTachu Avatar answered Sep 30 '22 23:09

imTachu