How to Override SonarCloud's Auto-Detected Project Key from Bitbucket Pipelines?

SonarCloud is automatically detecting the project key and organization key from Bitbucket Pipelines, but I want it to use the values I’ve set in my build.gradle file. Even though I’ve explicitly defined the sonar.projectKey and sonar.organization in the sonar { properties { … } } block, SonarCloud still picks up the project key from Bitbucket instead of the one I specified. How can I override this auto-detection and make SonarCloud respect the values set in Gradle?

These are the logs from the pipelines.
2025-01-29T12:06:07.690+0000 [INFO] [org.sonarsource.scanner.lib.internal.ScannerEngineLauncher] Detected project key ‘*****’ from ‘Bitbucket Cloud Pipelines’
2025-01-29T12:06:07.691+0000 [INFO] [org.sonarsource.scanner.lib.internal.ScannerEngineLauncher] Detected organization key ‘****’ from ‘Bitbucket Cloud Pipelines’.

It worked on my local with the values from build.gradle.

Hi,

Welcome to the community!

As described in the docs there’s a hierarchy to parameter values. Ones set on the analysis command line, or in this case, in your pipeline, override those set at lower levels.

You’re going to need to edit your pipeline.

 
HTH,
Ann