Configuration overview

This page explains the hierarchy and provides general configuration guidelines regarding the analysis parameters.

Settings hierarchy

You can configure project analysis settings mainly in the UI, in scanner configuration files, and as scanner arguments on the command line. Here is the hierarchy in order of precedence:

Analysis parameters can be set in (from the lowest to the highest priority) : project properties, scanner configuration files, scanner arguments on the command line.
  1. Project properties: You can change these properties in the UI and apply them to your project by going to Your Organization > Your Project > Administration > General Settings.

  2. Scanner configuration files: You can configure scanner parameters in a configuration file within your project or a build framework. Values set in the configuration file will override project properties set in the UI. See the individual scanner pages for more information.

  3. Scanner arguments: For CI-based analysis, you can also set parameters on the command line. This can be done with the standalone command-line tool sonar-scanner or with any of the build-tool-specific variants such as SonarScanner for Maven and SonarScanner for Gradle. Scanner arguments override the scanner configuration files.

If you use environment variables, which are available for some properties, they will be overridden by scanner arguments.

General configuration guidelines

Consider the following:

  • Most of the analysis parameters you can set in the UI can also be set in scanner configuration files or as scanner arguments by using the corresponding sonar properties (a sonar property is a key/value pair in which the key has the sonar.<property> syntax) .

  • Sonar property keys are case-sensitive.

  • Some analysis parameters cannot be set in the UI. There are listed in Parameters not settable in the UI.

  • Only parameters you set through the UI are stored in the SonarQube Cloud database. Parameters set in the command line or in the scanner configuration files will only be effective for the current analysis and not for subsequent analyses or analyses in SonarQube for IDE with connected mode. For example, if you override the sonar.exclusions parameter via the command line for a specific project, it will not be stored in the database. Subsequent analyses without the sonar.exclusions parameter in the command line or scanner configuration file, or analyses in SonarQube for IDE, will be executed with the exclusions stored in the database.

  • See the corresponding SonarScanner section in this documentation for general information about the configuration of analysis parameters in scanner configuration files or as scanner arguments:

  • If you use PowerShell, you need to wrap any parameter value that includes a dot (.) in either single or double quotes to prevent misinterpretation.

  • To adjust the analysis scope of your project, see the Analysis scope pages.

  • To include test coverage in your project analysis, see the Test coverage pages.

  • To import issues generated by third-party analyzers, see the External analyzer reports page.

Last updated

Was this helpful?