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

这条命令将重新编译您的

相关内容

热门资讯

玩家攻略!hhpoker作弊码... 玩家攻略!hhpoker作弊码,wepoker底牌透视脚本,本来真的是有挂(有挂工具)1、点击下载安...
一分钟揭秘!hhpoker辅助... 一分钟揭秘!hhpoker辅助靠谱吗,hhpoker有后台操控吗,果然有挂(今日头条)1、上手简单,...
推荐几款新版!wepoker辅... 推荐几款新版!wepoker辅助器官方,wepoker分析,好像真的是有挂(有挂秘籍)1、首先打开w...
今日百科!poker辅助器免费... 今日百科!poker辅助器免费安装,xpoker辅助助手,一贯存在有挂(真的有挂)辅助器是一种具有地...
必备攻略!pokerrrr2辅... 必备攻略!pokerrrr2辅助,pokerworld软件,都是是有挂(真实有挂)1、用户打开应用后...
三分钟了解!hhpoker真的... 三分钟了解!hhpoker真的有透视吗,wepoker有没有透视方法,都是真的是有挂(有人有挂)1、...
总算了解!德州透视插件,wep... 总算了解!德州透视插件,wepoker私人局辅助器怎么用,其实是真的有挂(有挂技巧)1、下载好wep...
六分钟了解!wpk德州局透视,... 六分钟了解!wpk德州局透视,wepoker有透视吗,原来有挂(有挂助手)1. 选牌创建新账号,点击...
总算了解!hhpoker有透视... 总算了解!hhpoker有透视功能吗,pokemmo手机版修改器,真是存在有挂(有挂教程)1、任何透...
一分钟了解!有哪些免费的wpk... 一分钟了解!有哪些免费的wpk作弊码,aapoker辅助器怎么用,原来存在有挂(真实有挂)1、辅助器...