Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

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

Version Matrix

Ant task

Sonar 2.6

Sonar 2.7

Sonar 2.8

1.0

(tick)

(tick)

(error)

1.1

(error)

(error)

(tick)

The way to configure the Sonar Ant task has changed between version 1.0 and version 1.1, so if you must use the Ant task version 1.0 please use this documentation page.

Prerequisites

  • Ant 1.7.0 or higher
  • Java 1.5 or higher
  • Sonar 2.8 or higher. The server must be up while running the Ant task.

Installation

  1. Download the Sonar Ant Task and put it in your ${ANT_HOME}/lib directory
  2. Declare the Sonar Ant Task and define the Sonar global configuration in a common Ant script file :

Analyze project

  1. Define a new sonar Ant target in your Ant build script :
    Icon

    Declaring a XML namespace for Ant tasks is optional but always recommended if you mix tasks from different libraries.

    Icon

    The Definition for key is groupId:artifactId. It has to consist of 2 values separated by colon (":").

    Icon

    For advanced features such as reusing existing unit test reports, you can define advanced parameters. These parameters are set with the <property> nodes of Sonar task.

  1. Execute the following command from the project base directory :
    Icon

    It's recommended to build the project before, usually to get bytecode and unit test reports.

Limitations

  • Modules (sub-projects) are not supported
  • Main sources and unit test sources can not be mixed in the same directory

Release Notes

Loading

Release 1.0 (1 issues)

Type Key Summary Priority Status Resolution
New Feature SONARPLUGINS-950 New ANT task to analyze projects Critical Closed Fixed

  • No labels