addLombokGeneratedAnnotation on lombok.config doesn't ignore Lombok Annotations on Jacoco report

Viewed 8350

I created a lombok.config file in my root directory with the following content:

config.stopBubbling = true
lombok.addLombokGeneratedAnnotation = true

But the Lombok generated codes (Getters, Setters, Builders, etc) still appears on my Jacoco test report.

Jacoco version is 0.8.6 and Lombok version is 1.18.12.

How can I remove Lombok code from reports?

3 Answers

You do not need to add any config properties, just add @Generated annotation along with @Data.

I had the same problem, with added lombok.addLombokGeneratedAnnotation = true Lombok still didn't add any @Generated annotation during compilation. It generated all the getters and setters, but none of them were annotated. Hence our test coverage was like 15% instead of about 70% without getters etc.

Solution was picking ANY random Lombok annotation and using it as @lombok.Getter instead of importing import lombok.Getter; and then using @Getter. I have no idea why it somehow triggered adding @Generated annotation everywhere where they were supposed to be added, but hey, if it works, it works.

Build once with lombok.addLombokGeneratedAnnotation = false which will cause the build fail with low coverage (assuming you have such rules configured).

After the failure, set lombok.addLombokGeneratedAnnotation back to true. Any consecutive builds should start passing again.

Can't explain why this happens, must be a Lombok bug.

Related