Full documentation for SonarQube has moved to a new location: http://docs.sonarqube.org/display/SONAR

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


This page describes how to integrate SonarQube TM into a build script for Apache Ant.


You must have previously installed the SonarQube TM Ant Task and read Analyzing Code Source.


Code Block
ant sonar


Since SonarQube TM 3.4, if a project cannot be accessed anonymously, the sonar.login and sonar.password properties are required to run an analysis on this project. These properties have to be set to the credentials of a user having the User role on this project. You can set them either:


Multi-module and Multi-language Project

Since SonarQube TM 3.3, it is possible to run an analysis on a multi-module project whose modules contains source code from different languages.


Additional analysis parameters can be defined in the build.xml file or through command-line parameters. 

Migrating from SonarQube


Ant Task 1.X to


SonarQubeAnt Task 2.0

The SonarQubeTM Ant SonarQubeAnt Task 2.0 can run analyses from configuration files designed for SonarQube TM Ant Task 1.X.

This compatibility mode is automatically activated. But we highly recommend you to migrate to the new format as this compatibility mode will be dropped sooner or later in the next versions.