Turn off coverage for certain lines in Java

I am using SonarQube and this is in the report:

It doesn’t make sense it shows that annotation in the first place. I tried turning the coverage off with configuration and adding the comments, like:

sonar.issue.ignore.block=e2
sonar.issue.ignore.block.e2.beginBlockRegexp=@sonar-ignore
sonar.issue.ignore.block.e2.endBlockRegexp=@end

That didn’t work, below also doesn’t work after adding it to a lombok.config file:

config.stopBubbling = true
lombok.addLombokGeneratedAnnotation = true

Any suggestions? I have other blocks of code I also want to exclude. In the UI it doesn’t seem like this is possible (my preference is in the code itself).

SonarQube server: 2025.1

Jacoco maven plugin: 0.8.13

Hi,

Welcome to the community!

Unfortunately, coverage exclusions are configured at the file level, not the line level. The good news though is that for a file that’s included in your coverage report, we go 100% by what’s in the report. So if a line is omitted by the coverage report (for whatever reason) we count it as un-coverable.

 
HTH,
Ann