Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 105 Next »

Table of Contents

Parameters to configure 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 any parameters

Mandatory Parameters

Sonar Server

Key

Description

Default value

sonar.host.urlSonar server URLhttp://localhost:9000

Database

Key

Description

Default value

sonar.jdbc.driverClassName 

JDBC Driver used by Sonar

org.h2.Driver

Prior to Sonar 3.2: org.apache.derby.jdbc.ClientDriver

sonar.jdbc.url

JDBC Connection URL

jdbc:h2:tcp://localhost:9092/sonar

Prior to Sonar 3.2: jdbc:derby://localhost:1527/sonar

sonar.jdbc.username

User for the JDBC Connection

sonar

sonar.jdbc.password

Password for the JDBC Connection

sonar

Project Configuration

Key

Description

Default value

Version

sonar.projectKey

The project key that is unique for each project.
Set through <groupId>:<artifactId> when using Maven.

  
sonar.projectName

Name of the project that will be displayed on the web interface.
Set through <name> when using Maven.

  
sonar.projectVersion
The project version.
Set through <version> when using Maven.
  

sonar.language

Sets the language of source code. By default, Sonar is using Java source code analyser. If a Sonar plugin allows to analyze another language, the associated source code analyser can be activated with this property.

java

since 2.0

sonar.sources

Comma-separated paths to directories containing sources.
Not compatible with Maven: source code retrieved from default location for Java Maven projects. 

  

Optional Parameters

Project Configuration

Key

Description

Default value

Version

sonar.projectDescription

Description of the project.
Set through <description> when using Maven. 

  
sonar.binaries

Comma-separated paths to directories containing binaries (in case of Java: directories with class files).
Not compatible with Maven: binaries retrieved from default location for Java Maven projects. 

  
sonar.tests

Comma-separated paths to directories containing tests.
Not compatible with Maven: tests retrieved from default location for Java Maven projects.  

  
sonar.librariesComma-separated paths to files with third-party libraries (in case of Java: JAR files)  

sonar.sourceEncoding

Encoding of source files. Example of values: UTF-8, MacRoman, Shift_JIS. This property can be replaced by the standard property project.build.sourceEncoding in Maven projects.

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

 

sonar.importSources

Sometimes, for security or other reasons, project sources must not be stored and displayed.

true

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 sonar.projectDate option. Format is yyyy-MM-dd, for example 2010-12-25.

Current date

since 1.5

sonar.exclusions

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.
Complete documentation on the Sonar web interface: go to MyProject > Exclusions. 

 

since 1.8

sonar.skippedModules

Some project modules should not be analyzed and consolidated with global project measures, for instance samples, integration tests or generated code.
If a module's artifactId differs from its module name (the directory name) : it is the artifactId that should be use instead of the module name. Format is a comma-separated list of modules : module1_toexclude,module2_toexclude.

 

since 1.5

sonar.includedModules

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.
If a module's artifactId differs from its module name (the directory name) : it is the artifactId that should be use instead of the module name.

 

since 2.2

sonar.branch

Manage SCM branches. Two branches of the same project are considered as different projects in Sonar.

 

since 1.10

sonar.profile

Through the Sonar web interface, you can define as many quality profiles as you want and you can easily associate one of this quality profile 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

sonar.skipDesign

Deactivate 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.

false

since 2.0

sonar.phase

Run maven phase or goal prior to analysis. When Sonar needs a phase or maven goal to be executed prior to analysis, this parameter can be used. For example sonar.phase=generate-sources. This property is used only for Maven analysis.

 

since 1.10

sonar.java.source

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 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

sonar.findbugs.excludesFilters

Enables to use Findbugs exclude filters

 

since 2.10

Unit and Integration Tests

Key

Description

Default value

Version

sonar.dynamicAnalysis

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 true, false, reuseReports.

See the Code Coverage by Unit Tests tutorial for details and examples.

true

since 1.7

sonar.surefire.reportsPath

The 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

Sonar Configuration

Key

Description

Default value

Version

sonar.host.connectTimeoutMs and sonar.host.readTimeoutMs

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 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

KeyDescriptionDefault valueVersion
sonar.showSqlDisplay all the SQL requests executed on batch sidefalsesince Sonar 2.14, Sonar Ant Task 1.4 & Sonar Runner 1.3
sonar.showSqlResultsDisplay the result of all SQL requests executed on batch sidefalsesince Sonar 2.14, Sonar Ant Task 1.4 & Sonar Runner 1.3
sonar.verboseActivation of the DEBUG mode on batch sidefalsesince Sonar 2.12, Sonar Ant Task 1.3 & Sonar Runner 1.2
  • No labels