Lombok annotation is not ignored in jacocoXmlReportPaths used by SonarQube

Hi team,

I have a multi module maven project, where I have created a separate module to show the aggregated jaCoCo coverage report from many maven modules. In each of the modules where I have used Lombok for boiler-plate code, I have a lombok.config file with the content:

lombok.addLombokGeneratedAnnotation = true

Now, when I run:

mvn clean verify

I can see in <project-for-aggregated-report-coverage>/target/site/jacoco-aggregate/index.html the generated jaCoCo reports that ignore the classes that use lombok, which is what I want. But, when I run the same with sonar using:
mvn clean verify sonar:sonar the classes that use lombok do not get ignored anymore and the coverage drops by 30% from the one reported through jacoco.

My question is, why aren’t lombok @Generated annotated classes getting ignored in SonarQube but they are from jacoco? Have I missed something?

Versions of the plugins below:

  1. SonarQube version 8.2.0
  2. SonarJava plugin version 6.1.0
  3. SonarQube Scanner version 4.1.0
  4. Jacoco Maven Plugin version 0.8.2
  5. Sonar-maven-plugin version
  6. Lombok version 1.18.12.

Additional info:

Also, in Jenkinsfile I use this property:
jacocoXmlReportPaths: './<project-for-aggregated-report-coverage>/target/site/jacoco-aggregate/jacoco.xml'

For maven multi module set up for jacoco to work I have a similar setup as in this example.

Any suggestions, would be more than welcome. Thank you.


Welcome to the community!

SonarQube analysis doesn’t handle Lombok in general (rules, coverage, …). If you want these things ignored for coverage purposes, take a look at setting coverage exclusions.