问题
I am using sonar runner with Jenkins to analyse a PHP project. The analysis seems to work fine and all of the reports are created by sonar-runner, however, the data does not show up on the dashboard.
Configuration:
sonar.projectKey=$Git_feature_branch
sonar.branch=$Git_feature_branch
sonar.projectName=XXXXXX
sonar.projectVersion=$Git_feature_branch-${BUILD_ID}
sonar.projectDescription=PHP Web Sonar Build
sonar.sources=${WORKSPACE}/XXXXXX/Bundles
sonar.tests=${WORKSPACE}/XXXXXX/Bundles/Bundle1/Tests
sonar.phpUnit.configuration=${WORKSPACE}/XXXXXX/app/phpunit.xml.dist
sonar.language=php
sonar.sourceEncoding=UTF-8
sonar.dynamicAnalysis=true
sonar.host.url=http://localhost:9001
sonar.jdbc.url=jdbc:mysql://quality.XXXXXX.com:3306/sonarqube?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true
sonar.jdbc.username=XXXXXX
sonar.jdbc.password=XXXXXX
sonar.host.url=https://quality.XXXXXX.com
sonar.phpPmd.reportPath=${WORKSPACE}/.sonar/phpmd.xml
sonar.phpCodesniffer.reportPath=${WORKSPACE}/.sonar/phpcs.xml
sonar.phpUnit.reportPath=${WORKSPACE}/.sonar/phpunit.xml
sonar.phpUnit.coverage.reportPath=${WORKSPACE}/.sonar/phpunit.coverage.xml
(I added the last four lines to try and force the reports but it didn't work). All of these reports contain data. However, when I go to the sonar dashboard for this project I have rules compliance of 100% and 0% unit test coverage (both incorrect from the reports).
回答1:
Check the SonarQube settings.I had once the same problem. It came out, i was working on two databases. So SonarQube was fetching data from the "empty" one.
来源:https://stackoverflow.com/questions/21582218/sonar-runner-not-creating-database-entries