[SalesForce] How to deploy and remove components in one step with the ant migration tool

I am familiar with how to use the destructiveChanges.xml file to remove components from my org. But it seems like I have to deploy then delete or vice versa. Is there a way to set up a package so that it will deploy and remove in a single ant command?

Best Answer

It actually is possible to do both together. You just need to put metadata component additions and updates into the package.xml, and component removals should be included in destructiveChanges.xml.

Then you can do a single deploy and it will work as expected.

I've put together a working example here: https://github.com/alan-morey/example-deploy-remove-force-components