With the Spring ’24 release, Salesforce is retiring the Ant Migration Tool, a Java/Ant-based command-line utility for moving Salesforce metadata between a local directory and a Salesforce org. The retirement of the Ant Migration Tool makes the Salesforce CLI the primary tool for using the Salesforce metadata services.

The Salesforce CLI is the flagship development tool in our ecosystem; it facilitates building, testing, deployment, and several other application development tasks for Salesforce Developers. Our strategy is to move toward a single tool that is frequently updated, maintained, and supported by Salesforce and avoid the redundancy of two tools that do the same thing. Hence, the decision to retire the Ant Migration Tool was made based on the Salesforce CLI’s adoption, maturity, and capabilities to provide command-line support for a wide range of Salesforce functionalities beyond metadata management.

In this blog post, you will learn about the implications of using the retired Ant Migration Tool and how to set up and use the Salesforce CLI, the preferred Salesforce standard, to automate your development workflows.

Implications of using the retired Ant Migration Tool

The Ant Migration Tool will continue to function for future API versions, but it will not be updated with any new functionality. However, if you continue to use it, you do run the risk of not being able to access any new functionality that was added to the API or any new metadata types released after API v59.0. Furthermore, if a major change is made to the backend APIs, then without any active maintenance and support, the tool may even be rendered broken. In this case, you would no longer be able to execute services from it, and your CI/CD pipelines would also break.

Simplify your workflow with Salesforce CLI

The Salesforce CLI is a powerful and versatile open-source tool that can automate not just metadata service-related tasks but also various actions all across the Salesforce Platform to build a truly modern CI/CD pipeline. With command-line support via built-in Visual Studio Code plugins for several products across the platform, it does much more than the Ant Migration Tool can provide.

The latest CLI developments with the release of sf (v2) have made it extremely easy to set up and use the tool. In fact, if you’re using Salesforce Code Builder, you don’t even need to set up the Salesforce CLI. Code Builder is a web-based integrated development environment that has all the power and flexibility of Visual Studio Code, Salesforce Extensions for VS Code, and the Salesforce CLI in your web browser. Regardless of your expertise level, whether you are an admin or a developer, you can easily experience the capabilities of the Salesforce Platform and its customizability via the Salesforce CLI using Code Builder.

You can authenticate and connect multiple orgs (scratch orgs, sandboxes, or production orgs) to your IDE via the CLI and seamlessly switch between them as you run commands. Using the concept of aliases, you don’t need to edit the properties file several times to connect to different orgs and run the metadata operations between them. Using the CLI, you have the flexibility of creating scratch orgs mimicking your production org on the go and connecting several orgs to the IDE. You also can enable pilot and beta features in the scratch orgs as you create them to develop new features or test them.

The project commands can be used to execute Metadata API operations from the Salesforce CLI. One of the highlights of the several options in this command is project generate manifest. Yes, you read it right. You can now generate the package.xml file by using a command without having to type it out.

Therefore, we recommend the sf CLI over the Ant Migration Tool due to wider support for commands and products, the option to connect multiple orgs simultaneously to the IDE, easier ways to authenticate orgs without the need to store credentials on file, and support for team collaboration via source tracking of metadata.

Development workflow with the Salesforce CLI

Installation and authentication

Download the CLI and set it up as per instructions on the Salesforce CLI Setup page. Once it is ready to go, verify that you have the latest version by running the sf version command.

Org management

You can choose either a scratch org-based or sandbox-based development model based on your business setup, and the Salesforce CLI coherently supports both. Once you have logged in to your dev hub, you can create a new scratch org for development and testing using the org create scratch command. To connect sandboxes or any other orgs, you can authenticate and log in to them using the org login web command and add aliases to easily identify and switch between these different types of orgs using the alias commands. Furthermore, you can set the shape of your org by enabling permissions via scratch org features in the scratch org definition file when creating the org.

Org login and scratch org creation using sf CLI

Generate application manifest

You can use the project generate manifest command to create the package.xml manifest file to be able to use Metadata API operations.

Generate manifest using sf CLI

Metadata management

Once you have the application manifest, you can use the plethora of project commands to move metadata between orgs. You can retrieve, deploy, validate deploy, quickly deploy a recently validated deploy zip, cancel a deploy, etc. You can use all of the operations that you could with the Ant Migration Tool and more. Note that if your org supports source tracking, then project deploy start and project retrieve start commands track only the changed metadata instead of all metadata.

Preview changes in your org by using the retrieve preview option, and then retrieve them to your local org with the retrieve start option.

Retrieve using sf CLI

Similarly, preview changes in your local org using the deploy preview option, and deploy them to the org using the deploy start option.

Deploy using sf CLI

Conclusion

The Ant Migration Tool, as useful as it might have been when it was first released, has run its course. It is time to move on to the modern, latest, and officially supported developer experience using the Salesforce CLI. As you explore the latest version of the Salesforce CLI, sf (v2), remember to report any bugs, feature requests, or unexpected behaviors via the CLI GitHub repository. We look forward to receiving your feedback and appreciate your ongoing support.

Resources

About the Author

Neha Ahlawat is a Senior Product Manager in the Platform Services organization at Salesforce, where she is focused on the product areas of Metadata API, source tracking, and change sets. Follow her on X and LinkedIn.

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS