| Info | ||||
|---|---|---|---|---|
| ||||
|
Parameters to configure project analysis of project can be set in various places in Sonar. Here is the hierarchy of parameters:
- Global analysis parameters, defined in the UI, will apply to all the projects
- Project analysis parameters, defined in the UI, will override global parameters
- Project analysis parameters, defined in project analysis configuration file or in analyzer configuration file, will override the ones defined in the UI
- Command line parameters, defined when launching an analysis, will override project analysis parameters
- Analyzer configuration file parameters (defined in the 'sonar-runner.properties' file for Sonar Runner, in the profile defined in the 'settings.xml' file for Maven), will override any parameters
Mandatory Parameters
...
sonar.profile parameter via command line for a specific project, it will not be stored in the database. Then, a local analysis in Eclipse will be run against the default quality profile.Mandatory Parameters
Server
Key | Description | Default value |
|---|---|---|
sonar.host.url | Sonar server Server URL | http://localhost:9000 |
Database
Key | Description | Default value | |||
|---|---|---|---|---|---|
| JDBC Driver used by Sonar | org.h2.Driver Prior to Sonar 3.2: org.apache.derby.jdbc.ClientDriver | sonar.jdbc. | JDBC Connection URL | jdbc:h2:tcp://localhost:9092/sonar Prior to Sonar 3SonarQube3.2: jdbc:derby://localhost:1527/sonar |
| User for the JDBC Connection |
| |||
| Password for the JDBC Connection |
|
Project Configuration
Key | Description | Default value | Version |
|---|---|---|---|
sonar.projectKey | The project key that is unique for each project. | ||
sonar.projectName | Name of the project that will be displayed on the web interface. | ||
sonar.projectVersion | The project version. Set through <version> when using Maven. | ||
| Sets Set the language of source code. If a Sonar plugin allows to analyze another language, the associated source code analyser can be activated with this property.The default language can be set at instance level: go to Configuration > General Settings > General and set the sonar.language property. |
| since 2.0 |
sonar.sources | Comma-separated paths to directories containing sources. |
Optional Parameters
Project Configuration
Key | Description | Default value | Version | |||||
|---|---|---|---|---|---|---|---|---|
sonar.projectDescription | Description of the project. | |||||||
sonar.binaries | Comma-separated paths to directories containing binaries (in case of Java: directories with class files). | |||||||
sonar.tests | Comma-separated paths to directories containing tests. | |||||||
sonar.libraries | Comma-separated paths to files with third-party libraries (in case of Java: JAR files). Pattern can be used. Example:
Note that * wildcard character is not supported for directories (only for files). This property is used by rule engines during issues detection (mainly SonarQubeengine and FindBugs engines which rely on bytecode). Having the bytecode of these libraries allows to get more information on coupling, possible null parameters when calling external APIs, etc. and thus getting more accuracy during issues detection. | |||||||
sonar.sourceEncoding | Encoding of source files. Example of values: UTF-8, MacRoman, Shift_JIS. This property can be replaced by the standard property The list of available encodings depends on your JVM. See http://docs.oracle.com/javase/1.5.0/docs/guide/intl/encoding.doc.html. | System encoding | ||||||
| Sometimes, for security or other reasons, project sources must not be stored and displayed. |
| since 1.5 | |||||
sonar.projectDate | It becomes quickly necessary to input historical data and to highlight some events. It is possible by going for example in a subversion tag and use the | Current date | since 1.5 | |||||
| Exclude files from analysis. This property is usually set in the page Settings of the project. It's a comma separated list of wildcard patterns. Paths are defined from the source base directory. Example: com/mycompany/*.java,**/*Dummy.java. |
| since 1.8 | See Project Administration for more details. This page also details |
|
| ||
| Some project modules should not be analyzed and consolidated with global project measures, for instance samples, integration tests or generated code. |
| since 1.5 | |||||
| Comma-separated list of the modules to analyse, all other modules are automatically ignored. Be careful: the root project must be added to the list. |
| since 2.2 | |||||
sonar.branch | Manage SCM branches. Two branches of the same project are considered as different projects in SonarSonarQube. |
| since 1.10 | |||||
| Through the Sonar web interface, you can define as many quality profiles as you want and you can easily associate one of this these quality profile profiles to a given project. You can also make this association by using the property "sonar.profile". | Default profile for the given language | since 1.6 | |||||
| Java bytecode analysis. Since Sonar 2.0, the java bytecode is analyzed by Sonar in order to extract dependencies between packages and files. Those dependencies are used for instance to display the DSM (Dependency System Matrix). This bytecode analysis can be deactivated.To skip the computation of design metrics and dependencies. Currently only available for Java. |
| since 2.0 | |||||
| Run maven phase or goal prior to analysis. When Sonar needs a When SonarQubeneeds a Maven phase or maven goal to be executed prior to the analysis, this parameter can be used. For example |
| since 1.10 | |||||
| java.sourceJava Version of the Source Code. This property is not used by the Sonar core but can be used by Java Sonar plugin like the PMD plugin. | 1.4, 1.5, 1.6 since 2.10. 1.7 since 2.12 | since 2.6 | |||||
sonar.java.target | Target Java Version of the Source Code. This property is not used by the Sonar core but can be used by Java Sonar plugin like the Clover plugin. | 1.4, 1.5 since 2.10 | since 2.6 |
Unit and Integration Tests
Key | Description | Default value | Version | |||||
|---|---|---|---|---|---|---|---|---|
| Dynamic analysis relates to unit tests. By default, those unit tests are executed but you can optionally decide to do only static analysis or to reuse existing reports which have been previously generated. Possible values are See | the the Code Coverage by Unit Tests tutorial for details and examples. |
| since 1.7 | ||||
sonar. | surefireworking. | reportsPathThe absolute or relative path of the surefire reports directory. Used only if sonar.dynamicAnalysis is reuseReports. See the Code Coverage by Unit Tests tutorial for details and examples. |
| since 1.7 | ||||
sonar.jacoco.reportPath | The absolute or relative path of the jacoco report file. Used only if sonar.dynamicAnalysis is reuseReports. See the Code Coverage by Unit Tests tutorial for details and examples. |
| since 2.12 | |||||
sonar.cobertura.reportPath | The absolute or relative path of the cobertura xml report file. Used only if sonar.dynamicAnalysis is reuseReports. See the Code Coverage by Unit Tests tutorial for details and examples. |
| since 1.7 | |||||
sonar.clover.reportPath | The absolute or relative path of the clover xml report file. Used only if sonar.dynamicAnalysis is reuseReports. See the Code Coverage by Unit Tests tutorial for details and examples. |
| since 1.7 | |||||
| sonar.jacoco.itReportPath | The absolute or relative path of the jacoco report file for integration tests. See the Code Coverage by Integration Tests tutorial for details and examples. | since 2.12 |
...
directory | To set the working directory for the SonarQube Runner or the SonarQube Ant Task (versions greater than 2.0). Beware: the specified folder is deleted before running each analysis. | .sonar |
Configuration
Key | Description | Default value | Version |
|---|---|---|---|
| Increasing HTTP timeouts of requests to Sonar server. The Maven plugin executes some HTTP requests to the Sonar server. Two timeouts makes the call fail fails if the server connection is too slow. In such a case the timeouts can be increased from Maven properties. | respectively 30'000 and 60'000 milliseconds | since 1.12 |
...
Log
| Key | Description | Default value | Version |
|---|---|---|---|
sonar. | cpd.${language_key}.minimumTokensMinimum number of successive duplicated tokens before triggering a duplication. Property inactive on java projects. | 100 | since 2.14 |
| sonar.cpd.${language_key}.minimumLines | Minimum number of successive duplicated lines before triggering a duplication. Property inactive on java projects. | 10 | since 2.14 |
Log
| Key | Description | Default value | Version |
|---|---|---|---|
showProfiling | Display logs to know where time is spent | false | |
sonar.showSql | Display all the SQL requests executed on batch side | false | since Sonar 2.14, Sonar Ant Task 1.4 & Sonar Runner 1.3 |
sonar.showSqlResults | Display the result of all SQL requests executed on batch side | false | since Sonar 2.14, Sonar Ant Task 1.4 & Sonar Runner 1.3 |
sonar.verbose | Activation of the DEBUG mode on batch side | false | since Sonar 2.12, Sonar Ant Task 1.3 & Sonar Runner 1.2 |

