There are several ways to deploy Salesforce from one organization or business to another. You could use change sets to migrate metadata, you could use the Force.com tool or you could also use the ANT tool.
The ANT tool has certain advantages over the other methods as listed below:
- ANT retrieves metadata using an XML from the server and then saves it to your computer. This means you can then edit the XML locally and then upload back to a server.
- Since you can save the XML file directly on the machine that you use to manage the process, you can thus save the same metadata as many times as you need to any server.
- With ANT, you can change and delete the target organizations metadata since you have access to it using an XML file.
- With ANT, you can migrate more components than with change sets.
- You can run ANT using command prompts.
- You can automate the process using command prompt batch files and XML files.
Here is the procedure you should use to deploy Salesforce using ANT. First ensure that you have the Java Development Kit 1.5 or above installed in your machine.
Step 1
Do a web search on the ANT Apache and download the latest ANT distribution from the source site.
Step 2
Extract the Zip file you downloaded previously and note the location that you downloaded it to.
Step 3
Then set the environment variable path to ANT_HOME ensuring that you are in the parent bin folder. If the PATH already exists, add %ANT_HOME% to the variable. Otherwise, add the new path without the %.
Step 4
Create another environment variable called JAVA_HOME and set it to the location of your Java development kit installation.
Step 5
To determine if ANT is installed correctly or not, open a command prompt and type in ant –v (v for version). If you get a message that confirms compilation of ANT, then jump to Step 6.
Otherwise, if you get an error, warning or notification saying something like “tools.jar cannot be located” then just go ahead and copy the file downloaded in Step 1 to the JRE/lib folder.
If you are successful with Step 5 then you have successfully configured ANT.
Step 6
The remaining steps involve downloading the Force.com migration tool from any organization that uses Salesforce.
After logging into Salesforce, start by locating the tool by going to your name in the setup menu. Navigate to DEVELOP and then to TOOL and select the Force.com Migration Tool link and download a Zip file to your computer.
Step 7
In the Zip file downloaded previously you will find some sample files and more importantly, a jar file called “ant-salesforce”. Copy and paste the file to the lib folder in your installed ANT directory.
You have now configured and set up your system, you are ready to deploy Salesforce using a Command Prompt and ANT.
Step 8
To start deploying using ANT, search for the XML files called “build” and “build.properties”. You can now start migrating components from organization to organization.
I hope this guide has been helpful to you.