5

I am using lombok in a spring project and building with gradle. All of the things were woking fine before. suddenly some errors have started coming.

Error is "Constructor(Constructor name) is undefined".

Have given all the DTO @Data,@NoArgsConstructor,@AllArgsConstructor, so ideally all the constructor should be available.

I have tried to build the project with old and new versions of Spring tool suite and changed lombok jar as well. but still same or different errors are coming.

Tried with STS4 and STS 3.9.7, 3.9.8 same issue is coming. Tried lombok 1.16.22, 1.18.0,1.18.2,1.18.8.

Please help me to resolve this issue.

Anjali
  • 1,623
  • 5
  • 30
  • 50
  • Are you getting compile time error? – Snehal Patel Jun 14 '19 at 10:58
  • does it work when building the project on the command line? – Martin Lippert Jun 14 '19 at 15:08
  • @Martin yes it builds through command line. – Anjali Jun 17 '19 at 11:02
  • then it sounds like an issue with the Lombok integration with Eclipse. You could try your project with a plain Eclipse 2019-03 install with Lombok added to that to see if that makes a difference - and if not, report the issue to the Lombok project. – Martin Lippert Jun 18 '19 at 12:06
  • I have the same problem with VisualStudioCode, using Maven and Lombok 1.18.22 ... `super("data");` showing error `The constructor *** is undefined` and could not be find in extended class that contains AllArgsConstructor annotation – Marek Bernád Jan 01 '22 at 16:12

1 Answers1

1

Might be issue with Lombok setup.

Did you follow below listed steps.

  1. Copy the lombok.jar to your STS installation path.
  2. Run the command and update your STS path.
java -jar /path/to/your/lombok.jar
  1. Update the STS.ini (aka SpringToolSuite4.ini) with
-javaagent:lombok.jar
  1. Restart STS/Eclipse.

Steps To Setup Lombok

KiriSakow
  • 957
  • 1
  • 12
  • 22
Snehal Patel
  • 1,282
  • 2
  • 11
  • 25
  • As somebody said in the comments section on the page you shared: “you NEED to close the STS/eclipse and start again. (Restart doesn’t take effect)” – KiriSakow Sep 01 '22 at 22:26
  • 1
    Instead of copying the JAR, you can also create a symbolic link in the STS installation directory pointing at the JAR: `ln -s ~/.m2/repository/org/projectlombok/lombok/1.18.24/lombok-1.18.24.jar lombok.jar` – KiriSakow Sep 01 '22 at 22:28