Sonar Maven Jacoco多模块项目的代码覆盖率 [英] Sonar maven jacoco code coverage for Multimodule project

查看:881
本文介绍了Sonar Maven Jacoco多模块项目的代码覆盖率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个多模块项目,其中有一个父pom.xml和其中的两个模块. Project.jar和Project.war.所有测试用例都在Project.jar下.当我在父pom上运行mvn sonar.sonar目标时,无法生成jacoco.exec,并且代码覆盖率为空.我在父pom中具有以下属性.

I have a multimodule project with a parent pom.xml and two modules in it. Project.jar and Project.war. All the test cases are under Project.jar. When I run mvn sonar.sonar goal on the Parent pom, jacoco.exec is not getting generated and code coverage is blank. I have the following properties in the parent pom.

<properties>
    <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
    <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
    <sonar.jacoco.reportPath>${project.basedir}/target/jacoco.exec</sonar.jacoco.reportPath>
</properties>

请帮助.我正在使用Sonarqube 4.2.

Please help. I am using Sonarqube 4.2.

推荐答案

对于Java插件2.4版,您必须在运行SonarQube分析之前生成覆盖率报告.您可以看到此页面 http://docs.codehaus.org/display/SONAR/JaCoCo+插件有关如何执行此操作.

With version 2.4 of the java plugin you have to generate the coverage report before running the SonarQube analysis. You can see this page http://docs.codehaus.org/display/SONAR/JaCoCo+Plugin about how to do this.

这篇关于Sonar Maven Jacoco多模块项目的代码覆盖率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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