---
schema_version: "1"
id: 619f7ef64c5343ea66f1aa99fa697e3aa49c3b928473da4a544543364d32aac9
title: Deploying Code
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/salesforce-migration-guide/guides/daas/forcemigrationtool-deploy-code.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-migration-guide/guide/forcemigrationtool-deploy-code.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 5accb8ad1d5cfa7b092633215c3ca17840b9a51e198d39af1a77ab22d00a9114
products:
  - Ant Migration Tool Guide
  - Platform Developer Content
---

# Deploying Code

**note:** 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.

You can deploy metadata components and Apex at the same time, but you may find it useful to create separate targets for deploying Apex, so that you can run tests as part of the deployment. A portion of a build.xml file is listed below, with a target named `deployCode` that deploys the contents of the codepkg package and runs the tests for one class.

```xml
<target name="deployCode">
  <sf:deploy 
      username="${sf.username}"
      password="${sf.password}"
      sessionId="${sf.sessionId}"
      serverurl="${sf.serverurl}"
      deployroot="codepkg">
    <runTest>SampleDeployClass</runTest>
  </sf:deploy>
</target>
```

**See Also**  


-   [Running a Subset of Tests in a Deployment](https://developer.salesforce.com/docs/platform/salesforce-migration-guide/guide/forcemigrationtool-deploy-run-specific-tests.md)

