I'm currently trying to configure a Sonarcloud in my SpringBoot project with gradle and bitbucket-pipelines. But for every PR and every branch it always shows 0% line coverage.
I've added the plugin configuration to my build.gradle
file:
id "org.sonarqube" version "3.4.0.2513"
and this is my bitbucket-pipelines.yml
file
image: openjdk:11
clone:
depth: full # SonarCloud scanner needs the full history to assign issues properly
definitions:
caches:
sonar: ~/.sonar/cache # Caching SonarCloud artifacts will speed up your build
steps:
- step: &build-test-sonarcloud
name: Build, test and analyze on SonarCloud
caches:
- gradle
- sonar
script:
- ./gradlew build sonarqube
artifacts:
- build/libs/**
pipelines: # More info here: https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html
branches:
master:
- step: *build-test-sonarcloud
pull-requests:
'**':
- step: *build-test-sonarcloud
Everything seems correctly configured on Bitbucket, the pipelines run for every PR and commit but all of them fail due the 0% coverage. I was expecting the correct test coverage to be shown on Sonar and Bitbucket PR decoration. Is there any configuration missing?