AndroidGradle-SonarCloud集成中Jacoco插件的覆盖率始终为0.0%。
创始人
2024-10-08 01:31:34
0
  1. 在build.gradle文件中添加Jacoco插件:

build.gradle(Project)文件中的dependencies区域添加以下代码:

classpath "org.jacoco:org.jacoco.core:0.8.7"

build.gradle(Module)文件添加以下配置:

  • 在android区域添加:
buildTypes {
        debug {
            testCoverageEnabled = true
        }
    }
  • 在dependencies区域添加:
dependencies {
    implementation "androidx.test.ext:junit:1.1.2"
    androidTestImplementation "androidx.test.ext:junit:1.1.2"
    androidTestImplementation "androidx.test.espresso:espresso-core:3.3.0"
    debugImplementation 'androidx.fragment:fragment-testing:1.3.4'
    // Required as the Jacoco plugin is being applied to the debug build type only.
    debugImplementation "org.jacoco:org.jacoco.agent:0.8.7"
}
  1. 修改SonarScanner Gradle插件:

build.gradle文件中的dependencies区域添加以下代码:

classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3"

在build.gradle(Module)文件添加以下配置:

plugins {
    id "org.sonarqube" version "3.3"
}

sonarqube {
    properties {
        property "sonar.projectKey", "your-project-key"
        property "sonar.organization", "your-org"
        property "sonar.host.url", "https://sonarcloud.io"
        property "sonar.branch.name", "your-branch-name"
        property "sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/jacoco/testDebugUnitTest.exec"
        property "sonar.junit.reportPaths", "${project.buildDir}/test-results/testDebugUnitTest"
        
    }
}
  1. 运行Gradle任务:

在终端中输入以下命令:

./gradlew clean jacocoTestReport sonarqube

这条命令将重新编译您的

相关内容

热门资讯

2024教程!wepoker透... 2024教程!wepoker透视脚本免费(透视)wepoker安装教程(分享教程有挂详细);无需打开...
每日必备!欢乐对决脚本(透视)... 每日必备!欢乐对决脚本(透视)hhpoker辅助软件(德州教程有挂猫腻)您好:hhpoker辅助软件...
查到实测!浙江宝宝游戏辅助器哪... 浙江宝宝游戏辅助器哪里能下载 无需打开直接搜索微信:136704302本司针对手游进行,选择我们的四...
玩家必备攻略!广东闲来辅助软件... 较多好评“微乐万能挂官网”开挂(透视)辅助教程 了解更多开挂安装加(136704302)微信号是一款...
透视智能ai!相约十三张辅助(... wepoker私人局俱乐部怎么进 无需打开直接搜索微信:136704302本司针对手游进行,选择我们...
揭秘几款!如何设置钱塘十三水辅... 揭秘几款!如何设置钱塘十三水辅助器(透视)wepoker有机器人吗(2026新版有挂方针);无需打开...
透视辅助!威胁你小程序雀神挂件... 透视辅助!威胁你小程序雀神挂件(透视)wejoker手机版透视脚本(2026版教程有挂存在) 了解更...
透视教学!欢乐情怀怎么开挂(透... 大家好,今天小编来为大家解答欢乐情怀怎么开挂这个问题咨询软件客服可以免费测试直接加微信(136704...
分享一款!山西扣点点脚本辅助器... 分享一款!山西扣点点脚本辅助器(透视)hhpoker有后台操控吗(高科技教程真实有挂)1、下载安装好...
盘点一款!丽水都莱辅助软件(透... 盘点一款!丽水都莱辅助软件(透视)we-poker软件(扑克教程有挂总结);亲,丽水都莱辅助软件这款...