How to use sonar.issue.ignore.allfile in settings.xml

With Java 21, Maven 3 and SonarQube 9.9.6 I’m trying to ignore all classes which have the jakarta.annotation.Generated annotation. I can only use the Maven settings.xml for that (especially not the UI).

I figured I need the sonar.issue.ignore.allfile XML Tag for that.
But setting it directly to the value @Generated leads only to a SonarQube error complaining to remove the “empty” tag (<sonar.issue.ignore.allfile>@Generated</sonar.issue.ignore.allfile>).

How do I set that tag correctly? Remember: I can’t access the UI admin page!

Hi,

There’s no way to exclude files from analysis based on their content. What you can do is ignore issues in files based on content. Is there a way to identify these files based on package or name?

 
Ann

But I ignored files based on their content. That is also exactly what’s described in the linked topic. The bad thing with the documentation is, that it says “… because it is a multi-value property, we recommend that it only be set through the UI.”. Which is really bad, just saying “it’s complicated, use the UI”, but in no way saying how to set it up without the UI. That is really, really frustrating.

And it’s actually pretty easy, I finally found the working solution on Stackoverflow:

<sonar.issue.ignore.allfile>r1</sonar.issue.ignore.allfile>
<sonar.issue.ignore.allfile.r1.fileRegexp>@Generated</sonar.issue.ignore.allfile.r1.fileRegexp>

That does the trick. Look at my issue graph, it’s a big progress, finally I can target real problems in my code:

Now I only have to find out how to apply that to duplicates and code coverage.