What is sonar.organization


We are starting with our sonarcloud trial and our maven builds fail using Gitlab CI with the following error message:

Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin: (default-cli) on project yyy: You must define the following mandatory properties for 'xxx:yyy': sonar.organization

Can you point me to the documentation explaining the sonar.organization property, please? What is the expected value and how do I set it? I would prefer if we can set it globally in a Gitlab CI environment variable.

Thank you,

Hey Robert

When following the tutorial in the UI, you will find instructions how to set it in the context of a Maven project.

OK, I can see it now - it is supposed to contain the “organization key” as set in the sonarcloud Administration → Organization details → Edit organization key

Is there an environment variable I can set globally in gitlab CI so that I don’t have to modify each and every project pom.xml file, please?

There is not. And, if it’s easier than editing the pom.xml, you can add -Dsonar.organization to your mvn command.

Thank you Colin, I’ve now managed to get the maven project working with sonarcloud.

The same issue with a “generic” project:

ERROR: Error during SonarScanner execution ERROR: You must define the following mandatory properties for 'XXX:YYY': sonar.organization ERROR: ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

Where do I specify sonar.organization for this use case, please?

It would really simplify things if there was an option to set this globally per gitlab group.

Thanks for your support.

The tutorial offers the next set of instructions (to add a sonar-project.properties file) if you click on continue.

Perfect, thank you. How could I miss that? It is working now.

And thanks for the feedback regarding setting this globally. I’ll make sure it is filed internally.

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