我们使用 jenkins 和 SonarQube 对我们的 php 项目执行代码分析。我们现在在不同的服务器上生成 phpunit 覆盖文件,并希望将这些覆盖文件加载到 SonarQube。问题是覆盖文件在那里并且似乎在 SonarQube 中加载但 SonarQube 中的代码覆盖仍然是空的。有趣的是代码覆盖率文件加载后的行:
INFO - Project: null
在这篇文章的旧声纳邮件列表中描述了几乎相同的错误:http: //sonarqube.15.x6.nabble.com/PHPUnit-test-coverage-from-PHPUnit-not-being-picked-up-with- Giving-Project-null-error-tc5028771.html#none
完整的跑步者日志:
INFO: Runner configuration file: /opt/sonar-runner/conf/sonar-runner.properties
INFO: Project configuration file: NONE
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: /var/lib/jenkins/jobs/FooBarJob-Dev/workspace/.sonar
INFO: SonarQube Server 5.0
INFO - Load global referentials...
INFO - Load global referentials done: 297 ms
INFO - User cache: /var/lib/jenkins/.sonar/cache
INFO - Install plugins
INFO - Install JDBC driver
INFO - Create JDBC datasource for jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true
INFO - Initializing Hibernate
INFO - Load project referentials...
INFO - Load project referentials done: 1514 ms
INFO - Load project settings
INFO - Loading technical debt model...
INFO - Loading technical debt model done: 30 ms
INFO - Apply project exclusions
INFO - ------------- Scan FooBarJob
INFO - Load module settings
INFO - Language is forced to php
INFO - Loading rules...
INFO - Loading rules done: 1442 ms
INFO - Configure Maven plugins
INFO - Compare to previous analysis (2015-06-18)
INFO - Compare over 30 days (2015-05-19, analysis of 2015-06-18 08:18:26.0)
INFO - No quality gate is configured.
INFO - Base dir: /var/lib/jenkins/jobs/FooBarJobDev/workspace
INFO - Working dir: /var/lib/jenkins/jobs/FooBarJob-Dev/workspace/.sonar
INFO - Source paths: src/main
INFO - Test paths: src/main/php/FooBarJob/Tests
INFO - Source encoding: UTF-8, default locale: en_US
INFO - Index files
INFO - Excluded sources:
INFO - **/Tests/**
INFO - **/Tests/**
INFO - Included tests:
INFO - **/Tests/**
INFO - 48 files indexed
INFO - Quality profile for php: Sonar way
INFO - Sensor NoSonar and Commented out LOC Sensor...
INFO - Sensor NoSonar and Commented out LOC Sensor done: 156 ms
INFO - Sensor QProfileSensor...
INFO - Sensor QProfileSensor done: 6 ms
INFO - Sensor org.sonar.plugins.php.PHPSquidSensor@118b47dc...
INFO - Sensor org.sonar.plugins.php.PHPSquidSensor@118b47dc done: 1984 ms
INFO - Sensor PHPUnit Sensor...
INFO - Analyzing PHPUnit tests report: var/phpunit.xml
INFO - Analyzing PHPUnit coverage report: var/coverage.xml
INFO - Project: null
INFO - Sensor PHPUnit Sensor done: 1507 ms
INFO - Sensor InitialOpenIssuesSensor...
INFO - Sensor InitialOpenIssuesSensor done: 127 ms
INFO - Sensor ProjectLinksSensor...
INFO - Sensor ProjectLinksSensor done: 15 ms
INFO - Sensor VersionEventsSensor...
INFO - Sensor VersionEventsSensor done: 40 ms
INFO - Sensor FileHashSensor...
INFO - Sensor FileHashSensor done: 114 ms
INFO - Sensor SCM Sensor...
INFO - Sensor SCM Sensor done: 125 ms
INFO - Sensor CPD Sensor...
INFO - DefaultCpdEngine is used for php
INFO - Cross-project analysis disabled
INFO - Sensor CPD Sensor done: 373 ms
INFO - Execute decorators...
INFO - Store results in database
INFO - ANALYSIS SUCCESSFUL, you can browse https://localhost/sonar/dashboard/index/com.barComp:FooBarJob
INFO - Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report.
INFO - Executing post-job class org.sonar.plugins.core.issue.notification.SendIssueNotificationsPostJob