# GitLab + SonarCloud Java

**URL:** <https://community.sonarsource.com/t/gitlab-sonarcloud-java/54772>\
**Category:** SonarQube Cloud\
**Tags:** gitlab, java\
**Created:** [December 13, 2021, 2:34am UTC](https://community.sonarsource.com/t/gitlab-sonarcloud-java/54772 "2021-12-13T02:34:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sonar2](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/sonar2/32/25180_2.png) [@sonar2](https://community.sonarsource.com/u/sonar2)\
**Post date:** [December 13, 2021, 2:34am UTC](https://community.sonarsource.com/t/gitlab-sonarcloud-java/54772/1 "2021-12-13T02:34:38Z")

</div>

How does SonarCloud integration with GitLab CI / Runners works for maven projects.  
Is there any equivalent bitbucket pipe that allows to scan and run the quality gate.  
or  
we have to go with the below command.  
- mvn -B org.jacoco:jacoco-maven-plugin:prepare-agent verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar

Reason being: We are using bitbucket pipelines with the above mvn command, it does not fail the pipeline even though the quality gate fails, wanted to check if there is any alternative in GitLab

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [December 13, 2021, 9:56am UTC](https://community.sonarsource.com/t/gitlab-sonarcloud-java/54772/2 "2021-12-13T09:56:35Z")

</div>

Hey there.

Take a look here:

> [@QUALITY GATE STATUS: FAILED - View details on \[MASKED\]/dashboard?id=house](https://community.sonarsource.com/t/quality-gate-status-failed-view-details-on-masked-dashboard-id-house/42164/2):
>
> Hey there. …and? Did you go to SonarQube to see why your Quality Gate failed? smiley From the documentation on [Gitlab integration](https://docs.sonarqube.org/latest/analysis/gitlab-integration/) Failing the pipeline job when the Quality Gate fails In order for the Quality Gate to fail on the GitLab side when it fails on the SonarQube side, the scanner needs to wait for the SonarQube Quality Gate status. To enable this, set the sonar.qualitygate.wait=true parameter in the .gitlab-ci.yml file. You can set the sonar.qualitygate.timeout property to an amou…

That answer was in the context of SonarQube, but you can find similar documentation for [SonarCloud here](https://sonarcloud.io/documentation/advanced-setup/ci-based-analysis/gitlab-ci/)

So running `mvn sonar:sonar -Dsonar.qualitygate.wait=true` should do what you’re looking for.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/system/32/31083_2.png) [@system](https://community.sonarsource.com/u/system)\
**Post date:** [January 27, 2022, 10:37am UTC](https://community.sonarsource.com/t/gitlab-sonarcloud-java/54772/3 "2022-01-27T10:37:34Z")

</div>

Closed on January 27, 2022, 10:37am UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
