Advanced parameters
There are extra parameters that can be used when running the Sonar maven plugin.
Hide sources
Sometimes, for security or other reasons, project sources must not be published.
option |
sonar.importSources |
usage |
|
from pom.xml |
|
since version |
1.5 |
Inject historical data
When using Sonar, it becomes quickly necessary to input historical data and to highlight some events. It is possible by going for example in a tag and use the sonar.projectDate option. By default, the version name to be used is the one in the pom.xml, but it is possible to override it using the sonar.projectVersion option.
option |
sonar.projectDate & sonar.projectVersion |
usage |
|
from pom.xml |
N/A |
since version |
1.5 |
Exclude some modules
Some project modules should not be analyzed and consolidated with global project measures, for instance samples, integration tests or generated code.
option |
sonar.skippedModules |
usage |
|
from pom.xml |
N/A |
since version |
1.5 |
Manage SCM branches
It is possible to run the Sonar maven plugin on a branch
option |
branch |
usage |
|
from pom.xml |
|
since version |
1.3 |
Skip install phase
In order for Sonar to run properly, the program must be compiled at some point. Until v. 1.4, the Sonar maven plugin was running an install goal by default. This phase can be skipped, for example for performance reasons.
Since v1.5, Sonar does not execute the install phase anymore.
option |
sonar.skipInstall |
usage |
|
from pom.xml |
N/A |
version |
before 1.5 |
Using environment variables
It is possible since v 1.5 to use environment variables in the sonar.properties file.
To use an environment variable, use the following syntax : ${env:NAME_OF_ENV_VARIABLE}.
For example :
Setting absolute path for extensions
It is possible to define an absolute path for extensions in the sonar.properties file. This parameter is useful when Sonar is deployed as a WAR. It avoids from packaging the WAR file each time extensions JARs are updated. The directory contains subdirectories like checkstyle/ and pmd/
Example

