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.
Setup line endings preferences :
For Unix/Mac users :
For Windows users :
Clone GIT repository
Sources can be checked out anonymously from GitHub :
Committers must configure their SSH key (see GitHub documentation for Windows and Mac) and clone repository with the following URL :
Build Sources
Increase the memory allocated to Maven (replace 'export' by 'set' on Windows) :
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 :
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 identifier | Activation | Description |
|---|---|---|
| dev | Deactivated by default. Can be activated with -Pdev | |
| release | Deactivated by default. Can be activated with -Prelease | |
| javadoc | Deactivated by default. Can be activated with -Pjavadoc | |
| m2e | Activated in Eclipse. |
IDE support
The following guidelines must be applied to SonarQubeand to the plugins that are hosted at Codehaus.
Eclipse
- Install Anyedit Eclipse Plugin
- Optional: if Maven projects do not define the profile ‘m2e’, then install the M2E error disabler plugin
- Restart Eclipse
- Windows → Preferences
- General
- Workspace
- Text file encoding: UTF-8
- Editors → AnyEdit Tools
- Remove trailing whitespace
- Create new line at the end of file
- Convert tabs – spaces
- Default convert mode on save: Tabs to spaces
- Workspace
- Java → Code Style
- Clean Up → Import… → sonar-cleanup.xml
- Formatter → Import… → sonar-formatter.xml
- Organize Imports → Import… → sonar.importorder
- XML → XML Files → Editor
- Indent using spaces
- Indentation size: 2
- General
- Open the Maven project: File → Import → Maven → Existing Maven Projects → select the root directory containing the file pom.xml
IntelliJ IDEA
- Download sonar-codestyle.xml to
~/Library/Preferences/IntellijIdea/codestyles/on Mac OS~/.IntellijIdea/config/codeStyles/on Linux~\.IntellijIdea\config\codeStyles\on Windows
- (Re)start IntellIJ IDEA
- Open the Maven project: File → Open Project → select the file pom.xml
- Use UTF-8 encoding: Project Settings → File Encodings → IDE Encoding: UTF-8
- Change the code style: Project Settings → Code Style → Scheme: sonar

