What is working around for quality gate pipe in bitubkcet pipeline for java project

  • ALM used (Bitbucket Cloud)
  • CI system used (Bitbucket Cloud)
  • Languages of the repository: Java

We have java project repositories in bitbucket. For CI we are using Bitbucketpipeline.
For code scan, sonarcloud is used.
In bitbucket, there is a sonar scanner pipe, but the issue with using a pipe is, the code coverage we see in sonar console, is always 0%.
As a workaround we are using,
“gradle build jacocoTestReport sonarqube” command.
It is showing the coverage properly. However, now we want to enforce the quality gate in pipeline and fail the build if quality gate is failed.
The sonar quality gate pipe available in bitbucket requires a sonar scanner pipe. Hence, we cannot use the quality gate pipe.
Can someone tell us what command/api is to be used to enforce the quality gate in the bitbucket pipeline?


The Quality Gate pipe currently only works with the sonar scanner pipe.
It won’t work for gradle/maven build.

We plan to add support for all build technologies in the near future, but I can’t tell you exactly when it will be available.


Yes, we are aware of it. Hence, want to know if there is any workaround for that.
Currently, we are using

“gradle build jacocoTestReport sonarqube”

command for scanning.
Is there any command to check the quality gate status and fail the build if the quality gate has failed.

There is no such command for the time being.

Oh ok.
So, can you please help us understand why sonar scanner pipe gives coverage as 0.0% ??
Thank you in advance.

You cannot use the scanner pipe with Java. You must use the gradle/maven command.

Thank you Benoit for your response.
So, if I understand correctly, as of now we cannot use sonar quality gate pipe with Bitbucket pipeline for Java repos as the sonar scanner pipe cannot be used for java.

Correct. You’ll have to wait that we add support of Maven/Gradle for the sonar quality gate pipe to be able to use it.

Hello Benoit,

Can you please tell us the ETA for the update, when we can use the sonar quality gate pipe with gradle command or an existing sonar scan report?

Hi @pritij,

We don’t have an ETA right now, it’s in our next priorities for the integration with BitBucketCloud.
You can watch and vote for the MMF here.

Thanks for your patience.