Sonarqube在运行后未显示代码覆盖率 [英] Sonarqube is not showing code coverage after running
问题描述
我正在和Maven一起运行声纳曲.
我已使用方式安装了它.
使用brew
,我安装了mysql
和sonar
.
运行时,我遇到了7个严重的错误,但88个测试的代码覆盖率为零
当我使用IntelliJ的工具运行它时,得到以下结果. (不为零!)
这是我直接检查Jacoco结果的时候.在$base_direc/target/jacoco/index.html
与声纳扫描仪一起运行时的相同代码
这是我的Maven配置
我的~/.m2/settings.xml
我已经在日志中找到了.
Edit2:
我已经编辑了~/.m2/settings.xml
已添加
<properties>
<sonar.host.url>http://localhost:9000/</sonar.host.url>
</properties>
已编辑/usr/local/Cellar/sonarqube/6.3.1/libexec/conf/sonar.properties
添加了sonar.host.url=http://localhost:9000/
添加了编辑的/usr/local/etc/sonar-scanner.properties
-sonar.host.url=http://localhost:9000/
以上述所有方式运行该应用程序,结果是相同的,即我可以看到Jacoco的结果,但不能在声纳中看到.
如果发现错误,声纳是否有可能拒绝进行代码覆盖?!
我找到了解决方案-
我随附的Maven插件将Jacoco的destfile和datafile配置为${basedir}/target/coverage-reports/jacoco-unit.exec
,但默认情况下,声纳的读数为${basedir}/target/jacoco.exec
.我将默认设置更改为 http://localhost:9000/settings?category = java >
参考:声纳代码覆盖率
I'm running sonarqube with maven.
I have installed it using following way.
Using brew
, I installed mysql
and sonar
.
When I run I get 7 critical bugs but the code coverage for 88 tests is zero
When I run it with IntelliJ's tools, I get the following results. (not zero!)
This is when I check Jacoco results directly. In $base_direc/target/jacoco/index.html
The same code when run with sonar-scanner
This is my maven configuration
My ~/.m2/settings.xml
Edit 1: I have found this in logs.
Edit2:
I have edited ~/.m2/settings.xml
added
<properties>
<sonar.host.url>http://localhost:9000/</sonar.host.url>
</properties>
Edited /usr/local/Cellar/sonarqube/6.3.1/libexec/conf/sonar.properties
added sonar.host.url=http://localhost:9000/
Edited /usr/local/etc/sonar-scanner.properties
added - sonar.host.url=http://localhost:9000/
Ran the application in all above ways and the results were same, i.e, I could see Jacoco results but not in sonar.
Is it possible that if bugs are found sonar refuses to do code coverage?!
I found the solution -
The maven plugin I have included has configuration of Jacoco's destfile and datafile as ${basedir}/target/coverage-reports/jacoco-unit.exec
but by default sonar reads at ${basedir}/target/jacoco.exec
. I changed the default at http://localhost:9000/settings?category=java
Ref: Sonar Code Coverage
这篇关于Sonarqube在运行后未显示代码覆盖率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!