Coverage shows 0% in SonarQube although tests run in CI.
IntermediateScenarioBuilds, Artifacts, Nexus, SonarQube and Testing
Answer
Situation read → The scanner cannot find the coverage report.
What I'd do →
- Generate the report before the scan (JaCoCo XML,
lcov.info,coverage.xml). - Pass its path:
-Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xmlor-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info. - Make sure the scanner runs in the same workspace after tests and with matching source paths.
Why → SonarQube imports coverage; it does not compute it.
Interview tip → Path mismatches inside containers are the common cause.
More on Builds, Artifacts, Nexus, SonarQube and Testing
A Maven project resolves dependencies from Maven Central on every build and a left-pad style outage would stop all builds.BeginnerYou must publish snapshot and release artifacts without overwriting a released version.IntermediateEvery merge to main should produce a unique semantic version automatically.IntermediateAn npm build is non-reproducible: different versions install on different days.BeginnerThe SonarQube quality gate must block merging PRs that add new bugs, vulnerabilities or uncovered code.IntermediateA big legacy codebase fails every Sonar gate. Teams ignore the tool. How do you adopt it?Intermediate