如何在不使用Maven的情况下将Jacoco报告与SonarQube集成? [英] How can I integrate Jacoco reports with SonarQube without using maven?

查看:173
本文介绍了如何在不使用Maven的情况下将Jacoco报告与SonarQube集成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Jacoco eclipse插件来衡量单元测试的覆盖率,并且能够使用它导出报告.我想将该报告与声纳集成在一起,因此在项目属性文件中给出了该报告的路径. 我的属性文件如下所示:

I used Jacoco eclipse plugin to measure unit test coverage and I was able to export a report using it. I want to integrate that report with sonar so I gave the path to it in the project properties file. My properties file looks like this

# Required metadata
sonar.projectKey=key
sonar.projectName=name
sonar.projectVersion=1.0
sonar.jacoco.reportPath=jacoco.exec
sonar.tests=junit
sonar.dynamicAnalysis=reuseReports
sonar.java.coveragePlugin=jacoco
sonar.jacoco.reportMissing.force.zero=true
# Comma-separated paths to directories with sources (required)
sonar.sources=src

# Comma-separated paths to directories with tests (optional)
sonar.tests=test

# Encoding of the source files
sonar.sourceEncoding=UTF-8

# Language
sonar.language=java

当我执行sonar-runner时,控制台输出中有以下几行

When I executed sonar-runner the following lines were there in the console output

16:23:13.219 INFO  - Sensor JaCoCoItSensor...
16:23:13.219 INFO  - No JaCoCo analysis of project coverage can be done since there is no class files.
16:23:13.219 INFO  - Sensor JaCoCoItSensor done: 0 ms
16:23:13.219 INFO  - Sensor JaCoCoOverallSensor...
16:23:13.219 INFO  - Sensor JaCoCoOverallSensor done: 0 ms
16:23:13.219 INFO  - Sensor JaCoCoSensor...
16:23:13.219 INFO  - No JaCoCo analysis of project coverage can be done since there is no class files.

单元测试覆盖率小部件还指示无数据". 为什么我无法让Sonar显示承保范围结果?正确的方法是什么? 这是我第一次与Jacoco接触,也是Sonar的新手,因此非常感谢详细的指南.

Also the unit test coverage widget indicated "No Data". Why am I not able to get Sonar to display the coverage results? What is the correct way to do this? This is my first experience with Jacoco and I'm also new to Sonar, so detailed guides are very much appreciated.

推荐答案

您必须指定"sonar.binaries"属性,该属性指向编译您的类的文件夹.

You must specify "sonar.binaries" property that points to the folder where your classes are compiled.

这篇关于如何在不使用Maven的情况下将Jacoco报告与SonarQube集成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆