SonarJava is going to reuse reports and not generate them, so before trying to configure your analysis to import these reports, you need to be sure they are correctly generated and not empty.
For Java projects, SonarQube enables you to load Unit Tests execution results and Coverage results.
How To Load JUnit Tests Results?
You need to provide the paths to the test execution reports using the following parameters.
|sonar.junit.reportPaths||This property works for Java projects only.||target/surefire-reports, myModule/target/surefire-reports|
Import tests execution reports (Surefire XML format).
Set the property with a list of comma-separated paths to the directories containing the XML reports.
How To Load JaCoCo Reports?
You need to provide the paths to the code coverage reports using one of the following parameters.
|sonar.coverage.jacoco.xmlReportPaths||This property works whatever the language (Java, Kotlin, ...)|
This property enables to load the XML format of the JaCoCo reports.
Comma-separated list of paths to JaCoCo XML report files. By default this file is named jacoco.xml.
|This property works for Java only.||target/jacoco.exec, target/jacoco-it.exec (default)|
This property enables to load the binary format of the JaCoCo reports.
Set the property to the path of the JaCoCo .exec report files, merge multiple reports.
Further details on using JaCoCo are available in Usage of JaCoCo with SonarJava.
If you are using sonar.coverage.jacoco.xmlReportPaths and you don't see your coverage data in SonarQube it means you don't have the JaCoCo Plugin installed (provided by default with SonarQube 7.4+).
SonarJava does not support import of Cobertura coverage data.
A sonar-cobertura plugin exists, however maintenance and support there is entirely community based. More generally speaking, also note that SonarQube provides a tool-agnostic generic solution: Generic Test Data .