On this page
Analysis parameters
Project analysis settings can be configured in multiple places. Each plugin and language analyzer adds its own properties which can be defined in the SonarQube UI; these properties can also be defined as analysis parameters, however, the descriptions of those properties and the best place to set them is in the UI when possible. Only parameters set through the UI are reusable for subsequent analysis and there is a structure to the way parameters are read by the scanner.
Here is the hierarchy in order of precedence:
- Global properties: Apply to all projects. Defined in the UI in Administration > Configuration > General Settings
- Project properties: Apply to one project only. At project level, defined in the UI in Project Settings > General Settings
- Project analysis parameters: Defined in a project analysis configuration file or scanner configuration file
- Analysis / Command line parameters: Defined when launching an analysis with
-D
on the command line
Note that only parameters set through the UI are stored in the database. 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, or analyses in SonarLint with connected mode, would still be executed with the exclusions defined in the UI and therefore stored in the DB.
Most of the property keys shown in the interface at both global and project levels can also be set as analysis parameters, but the parameters listed below can only be set at analysis time.
For language-specific parameters related to test coverage and execution, see Test coverage. For language-specific parameters related to external issue reports, see External issues. And to learn more about controlling the scope of your analysis, see the page on Analysis scope.
Analysis parameters are case-sensitive.
Mandatory parameters
Server |
Key | Description | Default |
sonar.host.url | the server URL | http://localhost:9000 |
Project configuration
Key | Description | Default |
sonar.projectKey | The project's unique key. Allowed characters are: letters, numbers, - , _ , . and : , with at least one non-digit. | For Maven projects, this defaults to <groupId>:<artifactId> |
Optional parameters
Project identity
Key | Description | Default |
sonar.projectName | Name of the project that will be displayed on the web interface. | <name> for Maven projects, otherwise project key. If not provided and there is already a name in the DB, it won't be overwritten. |
sonar.projectVersion | The project version. | <version> for Maven projects, otherwise "not provided". Do not use your build number as sonar.projectVersion . |
Authentication
By default, user authentication is required to prevent anonymous users from browsing and analyzing projects on your instance, and you need to authenticate when running analyses. Authentication is enforced in the global Security settings.
When authentication is required or the "Anyone" pseudo-group does not have permission to perform analyses, you'll need to supply the credentials of a user with Execute Analysis permissions for the analysis to run under.
Key | Description |
sonar.token | The authentication token of a SonarQube user with either Execute Analysis permission on the project or Global Execute Analysis permission. As an alternative to this property, you can create the SONAR_TOKEN environment variable and set the token as its value before you launch an analysis. |
Web services
Key | Description | Default |
sonar.ws.timeout | Maximum time to wait for the response of a Web Service call (in seconds). Modifying this value from the default is useful only when you're experiencing timeouts during analysis while waiting for the server to respond to Web Service calls. | 60 |
Project configuration
Key | Description | Default |
sonar.projectDescription | The project description. | <description> for Maven projects |
sonar.links.homepage | Project home page. | <url> for Maven projects |
sonar.links.ci | Continuous integration. | <ciManagement><url> for Maven projects |
sonar.links.issue | Issue tracker. | <issueManagement><url> for Maven projects |
sonar.links.scm | Project source repository. | <scm><url> for Maven projects |
sonar.sources | Comma-separated paths to directories containing main source files. | Read from build system for Maven, Gradle, MSBuild projects. Defaults to project base directory when neither sonar.sources |