On this page
SonarScanner for Ant
SonarScanner for Ant is deprecated. You can start using the SonarScanner instead by following the instructions below.
The SonarScanner for Ant provides a
task to allow the integration of SonarQube analysis into an Apache Ant build script.
The SonarScanner for Ant is an Ant Task that is a wrapper of the SonarScanner, which works by invoking the SonarScanner and passing to it all properties named following a
sonar.* convention. It is now deprecated. We recommend using the SonarScanner directly.
If you’re still using the SonarScanner for Ant, follow these steps to remove the wrapper from your build file, create a
sonar-project.properties in your project, and run the analysis.
The SonarScanner is installed on your machine.
- Create a
sonar-project.propertiesin your project.
- Move the
sonar.*properties from your
build.xmlfile to the
sonar-project.propertiesfile. For example:
See SonarScanner for more information on how to configure project properties.
Create a Sonar token and run the analysis using
Alternatively, instead of passing the token in your command line, you can create the
SONAR_TOKEN environment variable and set the token as its value before you launch the analysis.
See SonarScanner for more information.
For comparison purposes, a sample SonarScanner for Ant project is available here: https://github.com/SonarSource/sonar-scanning-examples/tree/master/sonar-scanner-ant/ant-basic
© 2008-2023, SonarSource S.A, Switzerland. Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution-NonCommercial 3.0 United States License. SONARQUBE is a trademark of SonarSource SA. All other trademarks and copyrights are the property of their respective owners.