简体   繁体   中英

SonarQube: Coverage on New Code never calculated

I have set up SonarQube, Maven and Cobertura to upload unit test coverage at every build run. I want to use the differential views to get coverage for the delta (new code only).

The coverage itself is successfully uploaded, and I can see the delta in lines of code. However, I can't get the "Coverage on new Code" to work.

I tried different values for the leak period, including previous_analysis and previous_version (changing the version from 1.0 to 1.1 in the new analysis). I also used -Dsonar.projectDate to simulate a past date of analysis but still no luck.

Any thoughts?

在此处输入图片说明

The key requirement to obtain new_code -related information/metrics is to leverage SonarQube SCM integration . And to benefit from that you have to install a compatible SCM Plugin applicable to your project (eg Git Plugin , SVN Plugin etc.).

“新代码覆盖率”仅在您使用/激活 SCM 支持(SVN、Git 等)时显示。

sonar.scm.disabled=false

Adding this sonar.java.binaries=classes directory, most likely target/classes helped me in fixing this issue. No JaCoCo analysis of project coverage can be done since there is no class files

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM