Configure Force.com Migration Tool for deployment Apache ANT

Force.com Migration Tool

Prerequisites for Using the Force.com Migration Tool

Before you can use the Force.com Migration Tool, Java and Ant must be installed and configured correctly. If you already have Java and Ant on your computer, you don’t need to install them, so first verify the installation from a command prompt.

 

Step 1 – Download and Install Java – Many of you have already installed the JDK in your system if not then you can download JDK from Here.

Download Java
Step 2 – Download Apache Ant – Apache Ant is a Java library and command-line tool whose mission is to drive processes described in build files as targets and extension points dependent upon each other. You can Download Apache Ant From Here

Download ANT.png
Step 3 – Set the path for ANT_HOME and JAVA_HOME :- After you have downloaded the Java and Apache Ant and JDK then place the Apache Ant into C drive for convenience.Now, let us set the path for both Java and Ant. Go to

  • Control Panel -> System and Security -> System -> Advance System Settings ->
  • a Popup will open Click Environment Variables – >

ANT_HOME.png

  • Click New under user variable and enter “ANT_HOME” for variable name and use ant location for variable value for example if you have pasted the ant into c drive then it will look like “C:\ant” click OK.

ANT_PATH.png

  • Again Click New under user variable and enter “JAVA_HOME” for variable name, use jdk location for variable value for example – “C:\Program Files\Java\jdk1.8.0_51”

JAVA_HOME.png
Step 4 – Set the PATH:- Now, we have added the path for Ant and Java. We need to add one more variable name PATH. Click New under user variable and enter “PATH” for variable name, use “%ANT_HOME%\bin;%JAVA_HOME%\bin;” for variable value.

PAHT_HOME.png
Now, time to do some testing for the above steps that we have setup until now. Open command prompt and type java -version hit enter, again type javac -version and hit enter. Now, type ant -version and hit enter you see the message like in below image.

Note: – If you receive Tools.jar not found error, go to “/Ant/manual/api/org/apache/tools/ant/util/JavaEnvUtils.html” and replace “java.home” with “java_home”.

CMD.png

Step 5 – Download Force.com Migration Tool: – In this step you need to download the force.com migration tool and can be downloaded from “Here“. After download unzip the file using 7Zip winrar or any other tool. You will see find a .jar file a html file and a folder name sample.

Salesforce ANT
Step 6 – Copy “ant-salesforce.jar” file from the file that you downloaded into step 5 (folder name “salesforce_ant_41.0”) and paste it to ant lib folder

Ant _ Salesforce

Download the required files from “Here” for the demo purpose.

Step 7 – After you downloaded the file from the above link place the file into your suitable location and unzip the file. Now, open build.properties file into any text editor and provide the credentials for the source and target Org then save as using properties extension of the file.

This slideshow requires JavaScript.

Step 8 – Open command prompt if you have closed this other wise use the same. Navigate to the directory where you have located this folder and then go to deploymentFolder folder.

Directory.png
Step 9 – It’s time to retrieve the data from the test Org type ant retrieve and hit enter

Retrieve.png

File Location

Step10 – Deploy the retrieved components into the Production Org. Type ant deploy

Deploy.png

If you have any problem then come up in the comment section with.

Hurray, you have setup the ANT with Salesforce for Deployment.

Happy Learning 🙂 😉

Sharing is Caring 🙂

 

Leave a Reply

Your email address will not be published. Required fields are marked *