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:
@lombok.Data
@Generated("jsonschema2pojo")
public class TestData {
@SerializedName("data")
@Expose
private Data data;
}
...
TestData productsItems = new Gson().fromJson(response,
TestData.class);
...
productsItems.getData().getProducts());
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?