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

Get Sonar Code Quality Testing Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.