Jenkins + SonarQube + JaCoCo -> coverage not available

We are trying to set up code coverage in SonarQube.
To that end we have set up Jenkins so it executes gradle task for jacoco before sonarqube task.
We have set sonar.coverage.jacoco.xmlReportPaths so it points to generated xml files.

However, coverage persists at 0% in sonarqube.
What can we do to further debug this?

Jenkins ver. 2.89.3
Sonarqube Version 7.7 (build 23042)

To analyse your issue further, thank you for providing analysis logs. If possible in debug mode so we can have a better view on the indexed files.
Also, please attach one of your coverage reports.

Hi, here is the relevant part of CE log

2019.08.22 03:49:48 TRACE ce[AWy4TWoN-ygTBAi2sEZQ][o.s.c.t.p.s.ScmInfoDbLoader] Reading SCM info from DB for file 'AWrhC7v7QYj4I9XxR_7f'
2019.08.22 03:49:48 TRACE ce[AWy4TWoN-ygTBAi2sEZQ][sql] time=0ms | sql=select id, project_uuid as projectUuid, file_uuid as fileUuid, created_at as createdAt, updated_at as updatedAt, binary_data as binaryData, line_hashes as rawLineHashes, line_hashes_version as lineHashesVersion, line_count as lineCount, data_hash as dataHash, src_hash as srcHash, revision from file_sources where file_uuid = ? | params=AWrhC7v7QYj4I9XxR_7f
2019.08.22 03:49:48 INFO  ce[AWy4TWoN-ygTBAi2sEZQ][o.s.c.t.s.ComputationStepExecutor] Compute new coverage | status=SUCCESS | time=6094ms
2019.08.22 03:49:48 INFO  ce[AWy4TWoN-ygTBAi2sEZQ][o.s.c.t.s.ComputationStepExecutor] Compute coverage measures | status=SUCCESS | time=231ms
2019.08.22 03:49:48 INFO  ce[AWy4TWoN-ygTBAi2sEZQ][o.s.c.t.s.ComputationStepExecutor] Compute comment measures | status=SUCCESS | time=6ms
2019.08.22 03:49:48 TRACE ce[AWy4TWoN-ygTBAi2sEZQ][sql] time=1ms | sql=select, m.metric_id as metricId, m.component_uuid as componentUuid, m.value, m.text_value as textValue, m.user_uuid as userUuid, m.description, m.created_at as createdAt, m.updated_at as updatedAt from manual_measures m where m.component_uuid=? | params=AWrYK4rBdJFWfLXqYq7Y

Apparently, it is calculating something, but coverage is still at 0%

Is there a way to verify coverage reports are actually making it so sonarqube server?

We used following command line

$ /home/jenkins/workspace/job/gradlew -Dsonar.coverage.jacoco.xmlReportPaths=module_a/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml,module_b/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml sonarqube

At one point in log, there is line

[org.gradle.internal.execution.impl.steps.CreateOutputsStep] Ensuring parent directory exists for property reports.enabledReports.xml.destination at  /data/workspace/job/module_a/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml

So far so fine.

At the end though, I found

[WARN] [org.sonarqube.gradle.SonarQubeTask] Report doesn't exist: ' /data/workspace/job/module_b/module_a/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml'

It looks like, for some reason, module_b is treated as base directory during SonarQubeTask.

After changing sonar.coverage.jacoco.xmlReportPaths to use absolute paths, coverage appeared in SonarQube.