Cannot use -Dsonar.qualitygate.wait=true with CloudBuild

Hey all,

I’m trying to use SonarQube with CloudBuild on GCP.

The error seems suggesting “-Dsonar.qualitygate.wait=true” isn’t a valid option, where did I go wrong?

  • Here is my CloudBuild.yaml
    steps:

    • id: ‘Maven build’
      name: Google Cloud Platform
      entrypoint: sh
      args:
      • ‘-c’
      • |
        mvn clean verify sonar:sonar
        -Dsonar.projectKey=project
        -Dsonar.host.url=https://sonar.server.com
        -Dsonar.java.binaries=target/classes
        -Dsonar.login=${_SONAR_TOKEN}
        -Dsonar.qualitygate.wait=true
  • Here is the error message
    [line 6: -Dsonar.qualitygate.wait=true: command not found]

  • Sonarqube Server Version
    [INFO] SonarQube version: 9.1.0

Hi,

Welcome to the community!

Maven seems to be taking that parameter as a separate command. Have you posted your exact syntax? Could there be some odd characters in there? Maybe put everything on one line?

 
Ann