Gatling with Lombok

Hi all!

I would like to ask if it is only me who has such a problem, or, again, I made an incorrect configuration of the project.

So what we have:

  • Project with Gradle (multimodule)
  • Java 17
  • Lombok
  • etc.

I make settings according to recommendations from Gatling and Lombok:

def lombokVersion = '1.18.24'
dependencies {
    gatlingCompileOnly "org.projectlombok:lombok:$lombokVersion"

I create a DTO class in which we will parse JSON and remove getters, setters, constructors, etc. from it. And add the annotation - @Data

I expand the DTO class structure in the IntelliJ IDEA and see that really works, there are getters, setters, etc.
I start writing the code using these getters - everything works fine.

Example of simple code:

public class TestData {

    private Data data;

TestData productsItems = new Gson().fromJson(response,

But when I run the code to execute, I get a compile-time error…

error: cannot find symbol
                .forEach( item -> productsItems.getData() )
  symbol:   method getData()
  location: productsItems of type TestData

Even if I clean the project through just gradle clean and then build it without running the tests gradle build -x test everything works correctly! Without any compile-time errors…

Even if I change from the gatlingCompileOnly to gatlingImplementation in the build.gradle file, the result is still the same. Also, @Getter and @Setter for a class or a separate field of a class do not help. The result is the same - there is no such getter in the class at execution.

And it looks like the java compilation with the Lombok works correctly without any errors, but when I call the code that triggers with Gatling, it doesn’t see these objects generated by the Lombok.

Did I configure something wrong?

Honestly, no idea. I personally won’t be able to help.

Then, instead of Lombok, can’t you use plain Java records?

Actually, yes, due to the fact that I cannot use @Getters from the Lombok, I’m using just plain Java records that are explicitly defined.

How you run code?

Can you provide example of code (project) that not working?

I’m not very familiar with Gatling and Gradle but:

Have you try:

dependencies {
  gatling "org.projectlombok:lombok:$lombokVersion"

Regarding to documentation (Gatling - Gradle Plugin) about things needed in compile and runtime - I think that here you need this dependencies in both.

@slandelle can I ask you to share access to this project? - GitHub - gatling/gatling-academy-module-2-java

I already prepared a new branch with an example code, why Lombok isn’t working.
I can’t push to this project.


Fork repo on GitHub and Push your branch to it and share link with us :slight_smile:

Absolutely. As its name states, this repository supports the module 2 of our Gatling Academy training. We definitely don’t want to pollute it with something unrelated. You can’t push there and PR would only be accepted if they fix something related to the training.

Please follow the link - GitHub - ayarema/gatling-academy-java-gradle-lombok at gatling-with-gradle-lombok

Clone, open - TestEdu class and try to make something with DTO and execute this test class.
You will see the error that there aren’t getters.

When you will create just plain Java records, it will works correctly.

That’s what I mean.
And there aren’t differences what you will do with dependencies block.

From Lombok documentation, you need to add the annotationProcessor as well.

I guess there is a gatlingAnnotationProcessor scope that is automagically created by gradle when we create the gatling scopes, but I didn’t test it.



@sbrevet , yes! Thanks!

When I added gatlingAnnotationProcessor all worked as planned.

We can close this topic.

@andriiiaremenko I have take your code and try to reproduce bug what you have write about and I don’t get it - everything is working without gatlingAnnotationProcessor so I’m wondering what is really issue at your case.
Can you give more details how to reproduce it… because at this moment I think that solution by adding gatlingAnnotationProcessor is not correct

I have clean target by .\gradlew clean and try to:
.\gradlew gatlingRun
.\gradlew build


.\gradlew clean
Starting a Gradle Daemon (subsequent builds will be faster)

1 actionable task: 1 executed

.\gradlew build

1 actionable task: 1 executed

.\gradlew clean                 

1 actionable task: 1 executed

.\gradlew gatlingRun            

> Task :gatlingRun
Running test with 5 users
Ramping users over 10 seconds
Total test duration: 60 seconds
Simulation gatlingdemostore.DemostoreSimulation started...

Clean target and run main method:

16:42:27: Executing ':TestEdu.main()'...

> Task :compileJava NO-SOURCE
> Task :compileScala NO-SOURCE
> Task :processResources NO-SOURCE
> Task :classes UP-TO-DATE
> Task :compileTestJava NO-SOURCE
> Task :compileTestScala NO-SOURCE
> Task :processTestResources NO-SOURCE
> Task :testClasses UP-TO-DATE
> Task :compileGatlingJava
> Task :compileGatlingScala NO-SOURCE
> Task :processGatlingResources
> Task :gatlingClasses

> Task :TestEdu.main()

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.


3 actionable tasks: 3 executed
16:42:29: Execution finished ':TestEdu.main()'.

so… buggie buggiee bugggieee where you are ? :slight_smile: