Problems Installing Sonar Scanner CLI
Which versions are you using
-
SonarScanner CLI:
4.0.0.1744(old version) -
Java:
21.0.10(also tested with system Java -
Language: Go (Golang)
-
No additional plugins or extensions installed
How is SonarQube deployed
-
SonarQube is used via SonarCloud (cloud-hosted instance)
-
No local SonarQube server is running (no Docker, no zip deployment, no Helm)
What are you trying to achieve
I am trying to install and use SonarScanner CLI in a Windows and Linux environment to analyze a Go (Golang) project and send the results to SonarCloud.
The goal is to run code analysis and coverage reporting from a local project using sonar-scanner.
What have you tried so far
-
Tried to follow the official documentation for SonarScanner CLI
-
Could not find a clear or modern downloadable ZIP in the official docs
-
Found an old GitHub repository with installation instructions (~7 years old)
sonar-scanner-cli/sonar-docs/analysis/scan/sonarscanner.md at master · SonarSource/sonar-scanner-cli · GitHub -
Downloaded and installed SonarScanner CLI version
4.0.0.1744from that repository -
Configured PATH and JAVA_HOME correctly
-
Generated Go coverage file using
go test -coverprofile=coverage.out -
Attempted to run analysis using:
sonar-scanner -Dsonar.token=... -Dsonar.host.url=https://sonarcloud.io -
Encountered Java compatibility issues:
-
Scanner is using Java 11 internally
-
Fails with
UnsupportedClassVersionErrorwhen using modern Java versions
-
Issue description
The installed SonarScanner CLI version is very outdated and forces Java 11 compatibility, which causes runtime errors when used with modern environments (Java 17/21).
Additionally, it is unclear from the official documentation where to download a supported or current version of SonarScanner CLI for modern setups.
The documentation seems to reference older installation methods or indirect downloads, and the GitHub repository contains outdated instructions that do not reflect current usage.
Question
What is the correct and recommended way to install and use SonarScanner CLI today?
Is there a modern download source or replacement tool that should be used instead of the old 4.0 CLI?
