How to delete components from Salesforce organization using Apache ANT Tool?

How to delete components from Salesforce organization using Apache ANT Tool?

Package.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <version>30.0</version>
</Package>

DestructiveChanges.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
        <members>Test</members>
        <name>ApexComponent</name>
    </types>
    <version>30.0</version>
</Package>

Build.xml:

<project name="Sample usage of Salesforce Ant tasks" default="test" basedir="." xmlns:sf="antlib:com.salesforce">


    <property file="build.properties"/>
    <property environment="env"/>

<target name="undeploy">
<sf:deploy
username="${sf.mydevusername}"
password="${sf.mydevpassword}"
serverurl="${sf.serverurl}"
deployroot="Target"/>
</target>

</project>

Command:

Note:
1. In DestructiveChanges.xml, * is not allowed.
2. The Package.xml should be blank without any components for deployment as mentioned above.

Leave a Reply