Cloud Technology

What is the best strategy to migrate from Ant Migration Tool to Salesforce CLI?

ST Asked by Steven Harris · 10-10-2025
0 upvotes 15,950 views 0 comments
The question

Since the Ant Migration Tool is being retired, my team needs to move our legacy deployment scripts to the Salesforce CLI (sf). We have a lot of custom XML manipulation in our current Ant build.xml. Is there a way to replicate the "Selective Retrieval" of the Ant tool using 'sf project retrieve start', and how do we handle 'destructiveChanges.xml' in the new CLI-driven DevOps flow?

3 answers

0
DO
Answered on 05-01-2025

The transition to Salesforce CLI is actually a huge upgrade in terms of speed and flexibility. Instead of manually editing 'package.xml', you should move toward a "Source Format" (sfdx-project.json). For selective retrieval, use the -m (metadata) or -p (sourcepath) flags in the sf project retrieve start command. For destructive changes, the modern way is to simply delete the file in your local source and use sf project deploy start. The CLI tracks the deletions and handles the 'destructiveChanges.xml' generation for you behind the scenes. It's much less error-prone than the old Java-based Ant tool.

0
CH
Answered on 12-02-2025

Are you planning to use the new "DevOps Center" alongside the CLI, or are you sticking strictly to command-line scripts? If you're building a CI/CD pipeline in GitHub Actions, the CLI's '--json' output makes it significantly easier to parse results and trigger Slack notifications compared to the old Ant logs.

ST 18-08-2025

Charles, we're definitely looking at GitHub Actions. The '--json' flag is a game changer for our automation! Dorothy, thanks for the tip on 'sourcepath'. I was worried I'd have to keep a giant 'package.xml' updated for every small change, but being able to just point to a folder/directory makes our feature-branching strategy so much more manageable. The migration seems a lot less daunting now.

0
NA
Answered on 15-03-2025

You can still use a 'package.xml' with the CLI if you prefer using the -x flag. It’s a great "middle ground" while your team gets used to the new command structure.

DO 20-03-2025

I agree with Nancy. We used the -x flag for the first two months of our transition. It allowed us to keep our old manifests while we learned the new 'sf' syntax.

Share your thoughts

Your email address will not be published. Required fields are marked (*)

Professional Counselling Session

Still have questions?
Schedule a free counselling session

Our experts are ready to help you with any questions about courses, admissions, or career paths. Get personalized guidance from industry professionals.

Request a Call Back

Search Online

We Accept

We Accept

Follow Us

"PMI®", "PMBOK®", "PMP®", "CAPM®" and "PMI-ACP®" are registered marks of the Project Management Institute, Inc. | "CSM", "CST" are Registered Trade Marks of The Scrum Alliance, USA. | COBIT® is a trademark of ISACA® registered in the United States and other countries.

Book Free Session