I couldn’t get SonarQube Code Coverage analysis to show coverage.
Sonar Scanner: 5.0.1
SonarQube Server: 9.9.0
gcovr 5.2
The project is very similar to this example:
linux-cmake-gcovr-gh-actions-sc
Steps:
- cmake configure
"${SONAR_BUILD_WRAPPER_CMD} cmake --build ...
ctest
gcovr --root ${SOURCE_DIR} --print-summary --sonarqube -o coverage.xml .
Analysis
sonar-scanner \
--define sonar.cfamily.build-wrapper-output="${BUILD_WRAPPER_OUT_DIR}" \
--define project.settings=sonar-project.properties \
--define sonar.cfamily.gcov.reportsPath=${BUILD_DIR}
Logs
00:39:29 INFO: SonarScanner 5.0.1.3006
00:39:29 INFO: Java 17.0.7 Eclipse Adoptium (64-bit)
00:39:29 INFO: Linux 5.13.0-1031-aws amd64
00:39:29 INFO: User cache: /home/build/.sonar/cache
00:39:30 INFO: Analyzing on SonarQube server 9.9.0.65466
00:39:30 INFO: Default locale: "en", source code encoding: "UTF-8" (analysis is platform dependent)
00:39:30 INFO: Load global settings
00:39:30 INFO: Load global settings (done) | time=61ms
...
...
00:39:42 INFO: Sensor gcov [cpp]
00:39:42 INFO: Sensor gcov [cpp] (done) | time=52ms
00:39:42 INFO: Sensor JaCoCo XML Report Importer [jacoco]
00:39:42 INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
00:39:42 INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
Has anyone encountered a similar issue with SonarQube Code Coverage analysis not displaying coverage, and if so, are there any suggestions or solutions to resolve this problem?