6

When I write

<sonar.jacoco.excludes>*.model.*</sonar.jacoco.excludes>

The package is not excluded from instrumentation / reporting and coverage shows as 0%

Why is this ?

Sonar version 3.6

MikePatel
  • 2,593
  • 2
  • 24
  • 38

2 Answers2

6

Common pitfall to use the wrong pattern to exclude. Notice the .

Bad :

<sonar.jacoco.excludes>*.model.*</sonar.jacoco.excludes>

Good:

<sonar.jacoco.excludes>*model*</sonar.jacoco.excludes>

Documentation for weary travellers.

MikePatel
  • 2,593
  • 2
  • 24
  • 38
  • 2
    How do you exclude specifc packages and files such as all the java files in one package? – TheDevOpsGuru Dec 03 '13 at 19:29
  • it's outdated. see this post https://stackoverflow.com/questions/12135939/how-to-make-sonar-ignore-some-classes-for-codecoverage-metric/27133765#27133765 – Yazazzello Oct 27 '17 at 09:56
6

I am using SonarQube version 4.5 and setting sonar.coverage.exclusions property worked in my case. Official documentation is here.

In your case I suggest to use the following property

sonar.coverage.exclusions=**/model/**/*
Mikalai Parafeniuk
  • 1,328
  • 15
  • 10