Getting Gradle, Java, Scala, Sonar and Jacoco to live in harmony?

(Sebastian H) #1


I have very successfully integrated Gradle (1.11), Sonar ( 4.1.1 ), Java, Scala and Jacoco in my build process.

I have one problem though. I can’t seem to get info about coverage per test / general info about the number of successful tests.

15:11:16.514 INFO - Sensor JaCoCoSensor… 15:11:16.535 INFO - Analysing C:\example\gradle-sonar-jacoco-scala\build\jacoco\test.exec 15:11:17.887 INFO - No information about coverage per test.

The Sonar web interface shows this :

The unit test coverage is correct but there’s more than 0 tests ( obviously ) .

How can I fix this ?

A simplified version of the project is at :

Cheers !

Scalatest result (not coverage) on sonar is incorrect
(Peter Niederwieser) #2


I believe this has been fixed for 1.12.

(Sebastian H) #3

Thanks Peter.

Already applied the fix at. If anyone is interested in this integration, the sample project is at :

However, I do have one remaining issue. I still get :

“No information about coverage per test”

Is there any way to fix this and find out the coverage per test ?

Cheers !

(Sebastian H) #4

Correct link is at :

(Peter Niederwieser) #5

‘sonar.jacoco.reportPath’ is set automatically. Perhaps try not to set it manually.

PS: Typically, code coverage tools only give accurate results if they specifically support the language used (and I don’t think JaCoCo specifically supports Scala).

PPS: Please don’t double-post here and on Stack Overflow.

(Sebastian H) #6

Hi Peter,

The code is written in Java and the tests are written in Scala, so in my opinion JaCoCo should have no

problem in determining coverage per test.

As for, “sonar.jacoco.reportPath” you are correct ; it’s not necessary ;

Anyways, thanks ;

Cheers !