Exclude generated code in sonar

Philippe Blayo picture Philippe Blayo · Dec 4, 2012 · Viewed 11.1k times · Source

How to exclude generated code from sonar processing and reporting?

I tried to exclude **/*generated* but packages like org.blayo.generated are still in report:

<plugin>
  ...
  <artifactId>maven-checkstyle-plugin</artifactId>
  <configuration>

    <excludes>**/*generated*</excludes>

Edit: The right regular expression was **/generated/*.java

Answer

Keppil picture Keppil · Dec 4, 2012

Use the sonar.exclusions property for this:

<properties> 
  <sonar.exclusions>**/*generated*</sonar.exclusions>
</properties>