Setting up the tool takes about an hour. The longer-term work is keeping the package.xml accurate as the org evolves and the test list current as classes are added.
- Install Java and Ant
Ensure a supported Java JDK is on the build machine and Apache Ant 1.10 or higher is installed. Verify with java -version and ant -version.
- Download ant-salesforce.jar
Get the latest jar from the Salesforce Tools download page and drop it into the build directory. Reference it in build.xml via a taskdef.
- Configure authentication
Set up build.properties with username, password, security token, and serverurl for legacy auth, or configure JWT bearer flow for the recommended path.
- Write a package.xml manifest
List the Metadata API types and component names to deploy or retrieve. Use the API version supported by the target org.
- Run validate, then deploy
Run ant deployCodeCheckOnly first to validate without applying. Once it passes, run ant deployCode (or use Quick Deploy) to apply the changes.
- Username/password authentication breaks every time the password rotates. Use JWT bearer flow for any production pipeline.
- Deployments roll back as one transaction on any error. Validate with checkOnly=true before applying to production to avoid surprise rollbacks.
- Large orgs need pollWaitMillis and maxPoll tuned. The defaults time out on deploys with thousands of components.
- The tool is feature-frozen. New Metadata API capability lands in Salesforce CLI first; Ant catches up later, if at all.