source: http://docs.codehaus.org/display/SONAR/Analysis+Parameters
Parameters to configure project analysis can be set in various places. 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
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 |
Server URL | http://localhost:9000 |
Database
Key |
Description |
Default value |
---|---|---|
|
JDBC Connection URL |
|
|
User for the JDBC Connection |
|
|
Password for the JDBC Connection |
|
Project Configuration
Key |
Description |
Default value |
---|---|---|
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.
|
|
|
Set the language of source code. If a plugin allows to analyze another language, the associated source code analyser can be activated with this property. |
|
sonar.sources |
Comma-separated paths to directories containing sources. |
Optional Parameters
Project Configuration
Key |
Description |
Default value |
|
---|---|---|---|
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 SonarQube engine 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. |
||
|
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. |
|
|
|
When starting to analyze a new project, you may want to feed your SonarQube instance with the quality snapshots of the last versions of this project. In order to get some information on quality trend over the last versions. When moving from one database engine to another, it is highly recommended (even mandatory) to start from a fresh new database schema. In this case, you will lose your whole history. So, you may also want to feed the new SonarQube instance with some historical data. To answer those use cases, you can use the The process is the following:
Note: first analyze the latest version and then move in chronological order to the newest one.
|
Current date |
|
|
Exclude files from analysis. See Project Administration#ExcludingFiles 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. |
|
|
|
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. |
|
|
|
Manage SCM branches. Two branches of the same project are considered as different projects in SonarQube. |
|
|
|
Through the web interface, you can define as many quality profiles as you want and you can easily associate one of these quality profiles to a given project. |
Default profile for the given language |
|
|
To skip the computation of design metrics and dependencies. Currently only available for Java. |
|
|
|
When SonarQube needs a Maven phase or goal to be executed prior to the analysis, this parameter can be used. For example |
|
|
|
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 Code Coverage by Unit Tests tutorial for details and examples. |
|
|
sonar.working.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 |
---|---|---|
|
Increasing HTTP timeouts of requests to server. The Maven plugin executes some HTTP requests to the server. Two timeouts makes the call 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 |
Log
Key | Description | Default value |
---|---|---|
sonar.showProfiling |
Display logs to know where time is spent | false |
sonar.showSql |
Display all the SQL requests executed on batch side | false |
sonar.showSqlResults |
Display the result of all SQL requests executed on batch side | false |
sonar.verbose |
Activation of the DEBUG mode on batch side | false |