The SonarScanner CLI is the scanner to use when there is no specific scanner for your build system. The SonarScanner does not support ARM architecture.
- Expand the downloaded file into the directory of your choice. We'll refer to it as
$install_directoryin the next step.
- Add the
$install_directory/bindirectory to your path.
- Verify your installation by opening a new shell and executing the command
sonar-scanner.bat -hon Windows). You should get an output like this:
If you need more debug information you can add one of the following to your command line:
- Create a configuration file in the root directory of the project:
- Set the environment variable
SONAR_TOKENwith the personal access token generated on My Account > Security > Generate Tokens. Note that the token can also be set through the command line argument
- Run the command
sonar-scanner.baton Windows, from the project base directory to run the analysis.
sonar-project.properties file cannot be created in the root directory of the project, the alternatives are:
- The properties can be specified directly through the command line. Example:
- The property
project.settingscan be used to specify the path to the project configuration file (this option is incompatible with the
- The root folder of the project to analyze can be set through the
sonar.projectBaseDirproperty. This folder must contain a
sonar-project.propertiesfile if the
sonar.projectKeyis not specified on the command line. Additional analysis parameters can be defined in this project configuration file or through command line parameters.
If the files to be analyzed are not in the directory where the analysis starts from, use the
sonar.projectBaseDir property to move analysis to a different directory. For example, when an analysis begins from
jenkins/jobs/myjob/workspace but the files to be analyzed are in
For more, see the listing of Analysis parameters.
Java heap space error or java.lang.OutOfMemoryError: Increase the memory via the
SONAR_SCANNER_OPTS environment variable:
In Windows environments, avoid using double-quotes, since they get misinterpreted, with the result that the two parameters are combined into a single one.
Unsupported major.minor version: Upgrade the version of Java being used for analysis or use one of the native package (that embed its own Java runtime).
sonar.cs.analyzer.projectOutPaths is missing: No protobuf files will be loaded for this project. SonarScanner is not able to analyze .NET projects. Please use the Scanner for MSBuild.