# sonar.coverage.exclusions: why SonarQube ignores your JaCoCo excludes > SonarQube counts files JaCoCo excluded as uncovered. Use sonar.coverage.exclusions with source paths like **/dto/**. Measured: 46.4% vs 81.3%. Web page: https://supercov.com/blog/sonar-coverage-exclusions · Published 2026-11-22 All Supercov pages for agents: https://supercov.com/llms.txt · Full text: https://supercov.com/llms-full.txt One project scanned six ways with SonarQube 26.11: which setting decides coverage, and which patterns match nothing. SonarQube does not read JaCoCo's `excludes`. Files missing from JaCoCo's report count in SonarQube as uncovered. Set `sonar.coverage.exclusions`, with source paths such as `**/dto/**`, and SonarQube leaves them out of coverage. ## sonar.coverage.exclusions vs sonar.exclusions | Setting | What SonarQube does with matching files | | --- | --- | | `sonar.coverage.exclusions` | Still analysed for bugs and smells; left out of coverage | | `sonar.exclusions` | Left out of the whole analysis, issues included | | JaCoCo's `` | Nothing: SonarQube counts those files as uncovered | We ran each setup with SonarQube Community Build 26.11, the SonarScanner for Maven 5.9 and JaCoCo 0.8.16, on a Maven project with five classes: two with tests, a DTO package and an application class with a nested class. Without exclusions SonarQube reported 39.4% coverage. ## Exclude files from coverage ```xml **/dto/**,**/ShopApplication.java ``` Coverage went to 81.3%: 8 of 10 lines and 5 of 6 branches, from `Pricing` and `Receipt` only. The same value on the command line, `-Dsonar.coverage.exclusions=…`, gave the same result. It gave 81.3% whether or not JaCoCo excluded anything. SonarQube decides coverage scope from its own setting; JaCoCo's excludes only change JaCoCo's own HTML and its `check` goal. Keep both in step, or set only the SonarQube one if SonarQube is your gate. SonarQube found `target/site/jacoco/jacoco.xml` without being told. Set `sonar.coverage.jacoco.xmlReportPaths` only for another path or for several modules. ## The same exclusions, two numbers With JaCoCo excluding `shop/dto/**` and `shop/ShopApplication*.class` and no SonarQube setting: | Report | Coverage | | --- | --- | | JaCoCo's own HTML | 8 of 10 lines (80%) | | SonarQube | 46.4%: 8 of 22 lines, the excluded files at 0% | SonarQube counted every line it considers executable in `OrderDto.java` and `ShopApplication.java` as uncovered, because the report had no data for them. ![Bars of SonarQube coverage for five setups: no exclusions 39.4%, JaCoCo excludes only 46.4%, sonar.coverage.exclusions only 81.3%, both 81.3%, class-file patterns in sonar.coverage.exclusions 46.4%.](https://supercov.com/assets/sonar-coverage-exclusions-flow-1360.b033f405ba.webp) *SonarQube's own setting decides coverage; JaCoCo's excludes do not.* ## Why your sonar.coverage.exclusions isn't working | What we tried | What happened | | --- | --- | | `shop/dto/**`, `shop/ShopApplication*.class` | Nothing excluded: SonarQube matches source paths, not classes | | JaCoCo `` only | 46.4%, the files counted as uncovered | | `sonar.exclusions` | 81.3%, but the files lost their bugs and smells too | ![A grid of five setups against four files. No exclusions and JaCoCo excludes only keep all four files in coverage. sonar.coverage.exclusions and sonar.exclusions keep Pricing and Receipt. Class-path patterns keep all four.](https://supercov.com/assets/sonar-coverage-exclusions-grid-1360.34df6beb30.webp) *Which files SonarQube counted in coverage, measured with SonarQube Community Build 26.11.* Patterns match source file paths from the project directory: `**/dto/**` worked, package-style and class-file patterns did not. Separate several patterns with commas. ## What Supercov adds ```sh npx supercov -- mvn test npx supercov runs latest gaps ``` SonarQube shows one blended number per file. Supercov records which test covered each line, with branches and MC/DC, and names the missing case. See [JaCoCo exclude](https://supercov.com/blog/jacoco-exclude.md) for JaCoCo's side and [JaCoCo vs SonarQube coverage](https://supercov.com/compare/jacoco-vs-sonarqube.md) for how SonarQube blends lines and branches.