Home » Java » Compilation error – Groovy and Lombok

Compilation error – Groovy and Lombok

Posted by: admin December 28, 2021 Leave a comment


Here is my Maven command

mvn clean compile test-compile test

this project

but I am facing with

[ERROR] no more tokens – could not parse error message: Groovy:unable to resolve class Delegate , unable to find class for annotation
[ERROR] 12. ERROR in D:\Projects\lombok-groovy-example-master\src\main\groovy\prystasj\lombok\example\groovy\Rocket.groovy (at line 5)
[ERROR] @Data

mvn –version

Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T22:39:06+03:00)

java -version

java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

Code from repository



Class (file on git differs!)

public class Rocket {

You shouldn’t use Lombok for Groovy, it is intended to be used only with Java.

Groovy has built-in annotation @Canonical which does what you want:

  • it creates useful equals, hashCode and toString methods
  • it creates no-arg and tuple constructor

So in your case use:

public class Rocket {}

Additionally you don’t need to create getters and setters for fields in Groovy. If you add any field to your class, Groovy would create getters and setters.