Я генерирую отчет о покрытии кода, используя jacoco и sonar в андроид студии. Я выполнил команды успешно, следуя видео с https://www.youtube.com/watch?v=acxwRaxoGAo.
Я получаю успешную сборку после выполнения, но на сервере сонара он показывает покрытие кода 0,0%
Project gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven { url 'http://repo1.maven.org/maven2' }
maven { url 'https://maven.google.com' }
maven { url 'https://mvnrepository.com/artifact/' }
maven { url 'https://maven.fabric.io/public' }
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven {
url "https://plugins.gradle.org/m2/"
}
google()
//maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:3.0.0'
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.1"
//classpath 'io.fabric.tools:gradle:1.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
maven { url 'https://mvnrepository.com/artifact/' }
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
flatDir {
dirs 'libs'
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven { url 'https://jitpack.io' }
google()
}
}
apply plugin: "org.sonarqube"
task clean(type: Delete) {
delete rootProject.buildDir
}
приложение Gradle:
apply plugin: 'com.android.application'
apply plugin: 'jacoco'
android {
compileSdkVersion 27
//buildToolsVersion '25.0.3'
defaultConfig {
applicationId "com.test.dev.MyProject"
minSdkVersion 15
targetSdkVersion 27
versionCode 3
versionName "3.2"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
buildTypes {
release {
minifyEnabled false
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
testCoverageEnabled true
}
}
sonarqube {
properties {
property "sonar.projectName", "MyProjectSonar"
property "sonar.projectKey", "com.test.dev.MyProject"
property "sonar.sources", "src/main/java"
property "sonar.language", "java"
property "sonar.sourceEncoding", "UTF-8"
//property "sonar.surefire.reportsPath", "target/surefire-reports"
property "sonar.jacoco.reportPaths", "target/jacoco.exec"
property "sonar.binaries", "target/classes"
//property "sonar.cpd.exclusions", "src/main/java/com/**/*.java"
}
}
}
jacoco {
toolVersion "0.8.0"
}
dependencies {
implementation(name: 'circleimageview-2.1.0', ext: 'aar')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.23.0'
// Testing-only dependencies
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'
// Testing-only dependencies
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
// required if you want to use Mockito for Android tests
androidTestImplementation 'org.mockito:mockito-android:2.7.22'
// Force usage of dependencies in the test app, since it is internally used by the runner module.
androidTestImplementation 'com.android.support:support-annotations:27.1.1'
}
apply plugin: 'com.google.gms.google-services'
Может кто-нибудь сказать мне, нужно ли мне делать какие-либо другие изменения. Я добавил плагин jacoco также в мой файл Gradle. Но на сервере эхолота покрытие кода все еще показывает 0.0%