Failing with missing sonar.projectKey' and 'sonar.organization'

  • ALM used (Bitbucket Cloud)

  • CI system used (Bitbucket Clouds)

  • Scanner command used when applicable (private details masked)
    mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=XXX

  • Languages of the repository: Java

Running the following Command fails with error that project key og organisation is missing:
mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=XXX

The Command is copied from
Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin: (default-cli) on project XXX: Project not found. Please check the ‘sonar.projectKey’ and ‘sonar.organization’ properties, the ‘SONAR_TOKEN’ environment variable, or contact the project administrator

Is the project key’ and organization not a part of the analyze command, or do I also have to add it to some property file locally on the Machine.

Any updates in this Ticket?.
I have verified that the key is precisely what is registered in Sonar—cloud administration.

I have chosen to analyze manually with Maven from the Local Machine.


The link you provided isn’t available to me. But yes, you must provide all of the things cited in the error message:

  • sonar.projectKey
  • sonar.organization
  • SONAR_TOKEN envvar

Could you provide a screenshot of where the in-app tutorial gave you an analysis command without making this clear?


A a screenshot is provided.


Thanks for this.

The screenshot gives three things to do:

  • set a SONAR_TOKEN envvar
  • update your pom to set sonar.organization
  • run the mvn analysis command, passing sonar.projectKey

All three pieces are required to make it work.


Ok I found the root cause, I was missing the environment variable.

Analyze process did continue without throwing the mentioned error.

Hello Ann, do you have any idea on this?

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