Sonar does not receive trial coverage information

Like SonarQube does not display a detailed report for each file for completely private classes through Gradle , but it is not a hoax.

Sonar Qube Version 3.7.4 Gradle Version 2.1

Running gradle sonarRunner creates a test.exec file that sonar does , picks up

 14:50:28.167 INFO - Analysing D:\projname\build\jacoco\test.exec 14:50:28.265 INFO - No information about coverage per test. 14:50:28.266 INFO - Sensor JaCoCoSensor done: 106 ms 14:50:28.529 INFO - Execute decorators... 14:50:29.253 INFO - Store results in database 14:50:29.391 INFO - ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/com.projname 

However, when updating the specified project, it shows coverage at 0%

Unit Coverage 0.0% 0.0% Line Coverage 0.0% Branch Coverage

I have installed

 sonarRunner { sonarProperties { property 'sonar.jacoco.reportPath', 'D:\\projname\\build\\jacoco\\test.exec' property 'sonar.junit.reportsPath','$buildDir/test-results' property 'sonar.tests', "$buildDir/classes/test" } } 

I tried \ and forward slashes - it doesn't matter

any ideas?

EDIT

As Peter's answer, remove sonarProperties - so build.gradle is basically

 subprojects { apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'sonar-runner' apply plugin: 'jacoco' sourceCompatibility = 1.7 group = 'com.mycomp' version = '1.0-SNAPSHOT' repositories { mavenCentral() } dependencies { testCompile 'junit:junit:4.10' } } 

This does not read the default exec file that is generated in D: \ projname \ build \ jacoco \ test.exec

Instead, it displays a message

 17:06:36.912 INFO - Project coverage is set to 0% as no JaCoCo execution data has been dumped: D:\projname\target\jacoco.exec 

Question: Are there any spaces in the folder names of the problem

+5
source share
1 answer

Use gradle test sonarRunner to make sure test results and coverage are up to date. Avoid absolute paths in build scripts. Groovy only performs String interpolation for double- "$buildDir/test-results" strings ( "$buildDir/test-results" ). If you use jacoco and java plugins, all Sonar properties specified in your snippet must be pre-configured.

+2
source

Source: https://habr.com/ru/post/1206621/


All Articles