O'Reilly logo

Sonar Code Quality Testing Essentials by Charalampos Arapidis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Analysis with Ant

Apache Ant, ant in the command line, is one of the oldest Java build tools around. Chances are you might be using it already or have switched to a more modern system such as Maven or Gradle. To perform a Sonar analysis, you need to create a new Sonar Ant Task and define the configuration inside an ant script file. Then, add a new Ant target referencing the sonar configured task inside your project's build script and provide path information for source, binaries, and project libraries.

First, let's go through the installation process.

Installing Ant

In order to use Ant in conjunction with Sonar, the following requirements must be met:

  • Ant 1.7.1 or higher
  • Java 1.5 or higher
  • Sonar 2.8 or higher

Download the latest Ant release from

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required