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

这条命令将重新编译您的

相关内容

热门资讯

现就发布提示透视挂!中至九江辅... 现就发布提示透视挂!中至九江辅助透视挂,妙趣斗地主真的有外挂,都是发现有挂1、在妙趣斗地主插件功能辅...
截至目前开挂!福建天天开心辅助... 截至目前开挂!福建天天开心辅助透视挂,丹东麻将真的是有外挂,真是有挂教程1、点击下载安装,福建天天开...
今日百科透视挂!蜀州麻将辅助透... 今日百科透视挂!蜀州麻将辅助透视挂,微乐海南麻将确实有外挂,一贯有挂秘籍1、下载好微乐海南麻将透视辅...
重要通知透视挂!新蜜瓜大厅辅助... 重要通知透视挂!新蜜瓜大厅辅助透视挂,衡阳丫丫竞技真的是有外挂,一直有挂秘笈1、很好的工具软件,可以...
玩家爆料开挂!慕星棋牌辅助透视... 玩家爆料开挂!慕星棋牌辅助透视挂,同乡游麻将确实有外挂,好像有挂分享1、进入到慕星棋牌是否有挂之后,...
一分钟了解透视挂!微乐河北麻将... 一分钟了解透视挂!微乐河北麻将辅助透视挂,锦绣乐游确实有外挂,都是有挂秘笈1、在微乐河北麻将插件功能...
现就发布提示辅助!番茄辅助透视... 现就发布提示辅助!番茄辅助透视挂,丹东麻将是真的有外挂,确实有挂实锤1、用户打开应用后不用登录就可以...
玩家必备攻略辅助!欢聚3辅助透... 玩家必备攻略辅助!欢聚3辅助透视挂,悠悠广东麻将是真的有外挂,确实有挂头条1、游戏颠覆性的策略玩法,...
我来教大家透视挂!九天揽月辅助... 我来教大家透视挂!九天揽月辅助透视挂,云胜麻将是真的有外挂,都是有挂头条1、很好的工具软件,可以解锁...
目前开挂!迅奇麻将辅助透视挂,... 目前开挂!迅奇麻将辅助透视挂,微竞二八夹麻将是有外挂,总是有挂教学1)迅奇麻将辅助插件:进一步探索迅...