SonarScanner for Ant
SonarScanner for Ant is deprecated. You can use the SonarScanner CLI instead by following the instructions below.
The SonarScanner for Ant provides a
task that is a wrapper of SonarScanner to allow integration of SonarCloud analysis into an Apache Ant build script. It is now deprecated and will be removed in the future. We recommend adjusting your configuration to use the SonarScanner CLI directly.
If you’re still using the SonarScanner for Ant, follow these steps to remove the wrapper, create a
sonar-project.properties, and run the analysis.
The SonarScanner CLI is installed on your machine. See Installation for more details.
- 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.
1. Set the environment variable
SONAR_TOKEN with the personal access token generated on My account > Security > Generate Tokens. Note that the token can also be set through the command line argument
2. Run the command
sonar-scanner , or
sonar-scanner.bat on Windows, from the project base directory to run the analysis.
For comparison purposes, a sample SonarScanner for Ant project is available here.