Skip to content
Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary

How to run an Ant Migration Tool deployment

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.

Steps
5
Steps
Level
Intermediate
Level
Category
Development
Category
By Dipojjal Chakrabarti · Founder & Editor, Salesforce DictionaryLast updated May 19, 2026

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.

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

Gotchas
  • 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.

Go deeper