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

Version 1 Next »

Step 1 - Install the database

Apache Derby is embedded by default with Sonar. It does not need any installation. It's great for demos and tests but we advice you to use a robust database for real use. The following are currently supported : MySQL 5.x, Oracle 10g XE, SQL Server 2005. It may work on another versions.

We recommend to create *an UTF-8 database* named 'sonar' accessed by a specific user 'sonar'. Here is an example with MySQL :

Tables and indexes are automatically created when browsing the first time to the homepage (see step 3).

Step 2 - Install the server

Download and unzip the [distribution|].

Configure the database

If you do not use the default embedded database, edit conf/ to configure the database access. Templates are available for MySQL and Oracle. Just uncomment them and comment the first four lines dedicated to derby.
* sonar.jdbc.url : the URL of the database
* sonar.jdbc.driver : the class of the driver
* sonar.jdbc.user : the username (default is 'sonar')
* sonar.jdbc.password : the password (default is 'sonar')

Example for MySQL :

For commercial databases, copy the JDBC driver to /extensions/jdbc-driver/[YOUR DATABASE]/. MySql and jTDS for SqlServer drivers are already provided.


You can increase the memory dedicated to the Java Virtual Machine (default is 512Mo) from the file conf/wrapper.conf :

If the Java VM you use is a JDK but not a JRE, the server mode can be activated. Just uncomment the following parameter from conf/wrapper.conf :

Publish your custom coding rules

Checkstyle and PMD provide extension mechanisms to develop custom coding rules. These extensions are managed by Sonar. Just copy some files to /extensions/rules/[pmd or checkstyle]/. More details on [the plugins page|Plugins]. Read [Checkstyle |]and [PMD|] documentations to learn how to write such extensions.

Step 3 - Start the server

Mode 1 - Start the standalone application

The default listen port is 9000 and the context path is /, so the web server listens to [http://localhost:9000]. To change these parameters, edit the file conf/ Here is an example to listen to [http://localhost:80/sonar] :

Execute the following script to start the server :
* on linux/mac : bin/[YOUR PLATEFORM]/ start
* on windows : bin/windows-x86-32/StartSonar.bat
Note that you can also run as a NT service with bin/windows-x86-32/InstallNTService.bat then bin/windows-x86-32/StartNTService.bat

You can now browse to [http://localhost:9000] and follow the setup instructions.

Mode 2 - Deploy on application server

More details on the page [SONAR:Deploy on application server]

Log in as administrator

Administrators can login with the username 'admin'. Default password is 'admin', that should be replaced from Configuration -> My account page.

(!) There is currently only one administrator account.

Step 4 - Configure Maven2

Sonar uses a Maven2 plugin to analyze sources and to inject measures into the database. That's why database properties must be defined into the Maven2 configuration. Edit the [settings.xml|] file, located into $MAVEN_HOME/conf or ~/.m2, and add the four parameters from step 2.

If data collection and server are on different boxes, set the server host with the property ''.

Example :

  • No labels