Sonar-scanner ignores projectKey given on CLI and uses instead

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension): 9.9.0 LTS, sonar-scanner, Ubuntu 20.04
  • how is SonarQube deployed: Helm
  • what are you trying to achieve: Scan a second project
  • what have you tried so far to achieve this: It works, but there’s a bug in sonar-scanner


  • We have a with some default settings.
  • Since we’re migrating to Bazel, but haven’t fully migrated I added a <project>-bazel next to my project in SonarQube.
  • Running analysis with -Dsonar.projectKey=<project>-bazel still posts the results to <project>.
  • All other CLI options overwrite the file options (as expected).

Replacing sonar.projectKey in with sed works.


It sounds likely that a sonar.projectKey override is being passed on the command line.


@ganncamp I’m passing the override on the command line, but it doesn’t work. I want to override it, but I can’t.


Can you share your file and full analysis log starting from the analysis command?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.