Prerequisites

Checkout Sources

Setup GIT

If you have never used git before, you need to do some setup first. Run the following commands so that GIT knows your name and email.

git config --global user.name "Your Name"
git config --global user.email "your@email.com"

Setup line endings preferences :

Clone GIT repository

Sources can be checked out anonymously from GitHub :

git clone git://github.com/SonarSource/sonar.git

Committers must configure their SSH key (see GitHub documentation for Windows and Mac) and clone repository with the following URL :

git clone git@github.com:SonarSource/sonar.git

Build Sources

Increase the memory allocated to Maven (replace 'export' by 'set' on Windows) :

export MAVEN_OPTS='-Xmx256m'

Some artifacts used by SonarQube are not in Central repository (e.g. fikin-ant), so you should ensure that SonarQube repository ( defined in pom.xml ) will be used :

http://repository.sonarsource.org/content/repositories/sonar

To run a complete build, execute "mvn clean install" in the root of the project directory. To quickly build in development environments, the script "quick-build.sh" does not execute unit tests and compile GWT components for Firefox only.

The distribution is generated in the directory sonar-application/target.

Profiles

Profile identifierActivationDescription
devDeactivated by default. Can be activated with -Pdev 
releaseDeactivated by default. Can be activated with -Prelease 
javadocDeactivated by default. Can be activated with -Pjavadoc 
m2eActivated in Eclipse. 

IDE support

The following guidelines must be applied to SonarQubeand to the plugins that are hosted at Codehaus.

Eclipse

  1. Install Anyedit Eclipse Plugin
  2. Optional: if Maven projects do not define the profile ‘m2e’, then install the M2E error disabler plugin
  3. Restart Eclipse
  4. Windows → Preferences
  5. Open the Maven project: File → Import → Maven → Existing Maven Projects → select the root directory containing the file pom.xml

IntelliJ IDEA

  1. Download sonar-codestyle.xml to
  2. (Re)start IntellIJ IDEA
  3. Open the Maven project: File → Open Project → select the file pom.xml
  4. Use UTF-8 encoding: Project Settings → File Encodings → IDE Encoding: UTF-8
  5. Change the code style: Project Settings → Code Style → Scheme: sonar