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

这条命令将重新编译您的

相关内容

热门资讯

一分钟了解!朋友圈2贵州捉鸡麻... 一分钟了解!朋友圈2贵州捉鸡麻将有挂透视吗(透视),朋友圈2贵州捉鸡麻将确实真的有透视模块1、起透看...
研究成果!原味麻将透视开挂(作... 研究成果!原味麻将透视开挂(作弊器),原味麻将确实存在有作弊器手段1、任何原味麻将透视是真的假的的玩...
分享一款!叮叮辅助工具(外挂)... 分享一款!叮叮辅助工具(外挂),叮叮一贯有外挂绝活1、叮叮破解器简单,叮叮机器人操作,叮叮插件,任何...
盘点一款!吉安麻将透视方法(透... 盘点一款!吉安麻将透视方法(透视挂),吉安麻将原来是有透视挂脚本1、完成吉安麻将有辅助插件,帮助玩家...
研究成果!好彩麻将真的有挂(辅... 研究成果!好彩麻将真的有挂(辅助器),好彩麻将切实真的是有辅助器方针1、好彩麻将有没有辅助教程、好彩...
一分钟揭秘!熊猫二人麻将透视方... 一分钟揭秘!熊猫二人麻将透视方法(外挂),熊猫二人麻将切实真的有外挂学习1、每一步都需要思考,不同水...
避坑细节!欢喜广西麻将透视是真... 避坑细节!欢喜广西麻将透视是真的吗(作弊器),欢喜广西麻将其实真的有作弊器经验1.欢喜广西麻将 选牌...
六分钟了解!鄱阳翻精破解软件(... 六分钟了解!鄱阳翻精破解软件(开挂),鄱阳翻精其实真的是有开挂练习鄱阳翻精透视方法中分为三种模型:鄱...
重大通报!叮叮辅助工具(外挂)... 重大通报!叮叮辅助工具(外挂),叮叮一贯是有外挂模块一、叮叮游戏安装教程牌型概率发牌机制”必胜“技巧...
分辨真假!星星河南麻将开挂破解... 分辨真假!星星河南麻将开挂破解(外挂),星星河南麻将切实存在有外挂讲义1、星星河南麻将免费辅助多个强...