This bootstrapper is recommended to run analysis on non-Java projects.
- Java 1.5 or higher
- Sonar 2.6 or higher. The server must be up when analyzing projects.
- Version 1.3 (Latest release, May 9 2012)
- Version 1.2 (December 22 2011)
- Version 1.1 (July 11 2011)
- Version 1.0 (Feb 18 2011)
- Uncompress the downloaded file into a directory named $SONAR_RUNNER_HOME in the next steps.
- Update the global settings (database connection, server URL) by editing the file $SONAR_RUNNER_HOME/conf/sonar-runner.properties
- Add the $SONAR_RUNNER_HOME/bin directory to your path.
You can check the basic installation by opening a new shell and executing the command 'sonar-runner -h' (on windows platform the command is 'sonar-runner.bat -h') . You should get a message like this :
If you need more debug information you can add the property sonar.verbose by adding the command line parameter -Dsonar.verbose=true
For each project a file sonar-project.properties must be created in the root directory of the project. This project configuration file must contain all properties required by Sonar to analyse the project :
Then the command 'sonar-runner' or 'sonar-runner.bat' (windows) must be executed from the project base directory to launch the Sonar analysis. That's it !
If a sonar-project.properties file can't be created in the root directory of the project, there are two alternatives :
- Either properties can be specified directly through the command line. Ex : 'sonar-runner -Dsonar.projectKey=myproject -Dsources=src1 ...'
- Or the property 'project.settings' can be used to specify the path to the project configuration file. Ex: 'sonar-runner -Dproject.settings=../myproject.properties'.
For advanced features such as reusing existing unit test reports, any Sonar advanced parameters can be defined in this project configuration file or through command-line parameters.
If you get an java.lang.OutOfMemoryError, you can set the SONAR_RUNNER_OPTS environment variable, like this in *nix environments:
On Windows environments, avoid the double-quotes, since they get misinterpreted, turning the two parameters into a single one.
Due to SONARPLUGINS-1024, not possible to set "." as a source directory with Sonar 2.6.
Here is the source code of a sample C project.
Here are some advanced optional properties that can be used for the Java Runner: