1
votes

This question is based on Sonar-Cobertura custom filters but as this was about Cobertura and my problem is with jacoco i think a new one is better.

Now that i had time to test the suggested property i must say it doesn't seem to work as expected. I wanted to exclude all content in a "command" package from the test coverage reports (as these will be tested in a system test and not in the normal nightly build). So i was setting the sonar.coverage.exclusions property in my ant build. The output was looking good:

[sonar:sonar] 15:04:50.223 INFO  - Excluded sources for coverage: 
[sonar:sonar] 15:04:50.223 INFO  -   src/main/java/**/command/*.java

But the project dashboard didn't change. All command classes are still listed with 0% coverage (the overall coverage did not increase). I even double checked with a project where some commands have coverage and these are still listed with the the same percentage as without the property set.

Setting the property manually in the Sonarqube instance or on the project didn't work too.

Here are the used components:

  • Sonarqube 4.5.4 (LTS)
  • java-plugin 3.3
  • test-coverage-tool jacoco
  • source code in java 1.6
  • ant 1.9.6 (run with java 8)
  • sonar-ant-tasks 2.2

Any ideas what i missed or where to look next?

1
Could you give a new try with the following exclusion patter : <pre>**/command/*.java</pre>Freddy - SonarSource Team
I'll give it a try without the <pre> tags, or did you mean to include them?dag
[sonar:sonar] 10:38:44.168 INFO - Excluded sources for coverage: [sonar:sonar] 10:38:44.168 INFO - **/command/*.java but the packages/sources are still listed with 0% coveragedag

1 Answers

0
votes

Just in case anyone stumbles upon the same problem. This was a bug in SonarQube 4.5.4 that was fixed with 4.5.5

So just updating the basic SonarQube Installation (this bug was not plugin related) fixes the issue.