Newer Version Available

This content describes an older version of this product. View Latest

Retrieving Managed or Unmanaged Packages

The Ant Migration Tool is retired with Spring ’24. The tool continues to function for future API versions but isn’t updated with new functionality and isn’t supported. To manage metadata changes, switch to Salesforce CLI for a modern, supported developer experience.

Note

Packages are useful for distributing related bundles of metadata across multiple instances or organizations, via Lightning Platform AppExchange. However, you can use the Ant Migration Tool to freely retrieve and deploy packaged metadata without using AppExchange. You retrieve both managed and unmanaged packages in the same way.

To retrieve a package, specify a packageNames parameter in the build.xml file. For example:

1<target name="retrieveNamedPackage">
2  <sf:retrieve 
3      username="${sf.username}" 
4      password="${sf.password}"
5      sessionId="${sf.sessionId}" 
6      serverurl="${sf.serverurl}" 
7      retrieveTarget="projectFolder" 
8      packageNames="mySourcePackage"/>
9</target>