参考:声纳代码覆盖率 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 zeroWhen 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.htmlThe same code when run with sonar-scannerThis is my maven configurationMy ~/.m2/settings.xmlEdit 1:I have found this in logs.Edit2:I have edited ~/.m2/settings.xmladded <properties> <sonar.host.url>http://localhost:9000/</sonar.host.url></properties>Edited /usr/local/Cellar/sonarqube/6.3.1/libexec/conf/sonar.propertiesadded 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.execbut by default sonar reads at ${basedir}/target/jacoco.exec. I changed the default at http://localhost:9000/settings?category=javaRef: Sonar Code Coverage 这篇关于Sonarqube在运行后未显示代码覆盖率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的.. 09-06 23:45