Retrieving Unpackaged Components
The Ant Migration Tool is retired with Spring ’24. The tool continues to function as-is for future API versions but isn’t updated with new functionality and isn’t supported. If Salesforce adds a new feature that is incompatible with Ant, the Ant Migration Tool won’t be updated to support it. To manage metadata changes, switch to Salesforce CLI for a modern, supported developer experience.
The unpackaged package contains all of the standard objects, custom objects, Apex classes and other metadata components that exist natively in your organization, and not within a package. To retrieve unpackaged components, use a build.xml target that contains the unpackaged attribute that points to a package.xml file. For example:
1<target name="retrieveUnpackaged">
2 <mkdir dir="projectFolder"/>
3 <sf:retrieve
4 username="${sf.username}"
5 password="${sf.password}"
6 sessionId="${sf.sessionId}"
7 serverurl="${sf.serverurl}"
8 retrieveTarget="projectFolder"
9 unpackaged="unpackaged/package.xml"/>
10</target>
The salesforce-ant.jar file contains Ant tasks for accessing the Metadata API. In the code above, sf:retrieve is an Ant task. The full list of metadata Ant tasks are described in the Metadata API Developer Guide.