Must-share information (formatted with Markdown):
- which versions are you using (SonarQube Server / Community Build, Scanner, Plugin, and any relevant extension) * Community Build v25.2.0.102705
- how is SonarQube deployed: zip
- what are you trying to achieve: Running sonar-scanner as part of Gitlab CI/CD pipeline to scan code. Upgraded sonar-scanner from 5.0.1.3006 to 7.0.1.4817 but sonar scanner is not picking up sonar.token from sonar-scanner.properties
- what have you tried so far to achieve this
verified that the sonar-scanner.properties has a valid sonar.token value.
Also, added SONAR_TOKEN= inside sonar-scanner.properties
Also, updated /opt/sonar-scanner/latest/bin/sonar-scanner to pass
exec "$java_cmd" \
-Djava.awt.headless=true \
-Djava.net.useSystemProxies=true \
$SONAR_SCANNER_OPTS \
$SONAR_SCANNER_DEBUG_OPTS \
-DSONAR_TOKEN=<value>\
-Dsonar.token=<value> \
Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!
sonar-scanner
12:07:15.843 INFO Scanner configuration file: /opt/sonar-scanner/sonar-scanner-7.0.1.4817/conf/sonar-scanner.properties
12:07:15.848 INFO Project root configuration file: /home/gitlab-runner/builds/<xxxx>/0/<xxxxx>/<xxxxx>/sonar-project.properties
12:07:15.871 INFO SonarScanner CLI 7.0.1.4817
12:07:15.873 INFO Java 21.0.6 Ubuntu (64-bit)
12:07:15.878 INFO Linux 6.8.0-1021-aws aarch64
12:07:15.929 INFO User cache: /home/gitlab-runner/builds/<xxxx>/0/<xxxxx>/<xxxxx>/.sonar/cache
12:07:17.333 INFO EXECUTION FAILURE
12:07:17.334 INFO Total time: 1.495s
12:07:17.333 ERROR Failed to query server version: . Please check the property sonar.token or the environment variable SONAR_TOKEN.