Installing ANT migration tool in Ubuntu (Linux)

Ant is a command-line utility tool used for moving metadata between a local directory and a Salesforce organization and vice versa.

Ant Tool is useful in the following scenarios:

  1. When you need to populate an environment with large amounts of setup changes.
  2. Multistage release processes — A typical development process requires iterative building, testing, and staging before releasing to a production environment. Scripted retrieval and deployment of components can make this process much more efficient.
  3. Repetitive deployment using the same parameters — You can retrieve all the metadata in your organization, make changes, and deploy a subset of components. If you need to repeat this process, it's as simple as calling the same deployment target again.
  4. When migrating from stage to production is done by IT — Anyone that prefers deploying in a scripting environment will find the Force.com Migration Tool a familiar process.

Prerequisites : 

  1. Java 
  2. Ant 

 

Installing java 

Check whether java is installed or not in your machine using the following command in your terminal.

java -version 

If you get the follwing kind of output then java is installed in your machine.

image

 

java version "1.7.0_75"
OpenJDK Runtime Environment (IcedTea 2.5.4) (7u75-2.5.4-1~trusty1)
OpenJDK Server VM (build 24.75-b04, mixed mode)

Otherwise install using the following commands

sudo apt-get install default-jre

image

 

sudo apt-get install default-jdk

image

 

This will install JDK and JRE in your machine.

Installing Ant

Check wheather Ant is installed or not in your machine using the following command in your terminal.

ant -version

If you get the follwing kind of output then ant is installed in your machine.

image

 

Apache Ant(TM) version 1.9.3 compiled on April 8 2014

Otherwise install using the following commands

sudo apt-get install ant

image

 

This will install ant in your machine.

Integrating salesforce with ant :

Login to your org go to Setup --> Develop --> Tools and click on Force.com Migration Tool 

It downloads a zip file which contains a Sample folder , ant-salesforce.jar and Readme.html 

ant-salesforce.jar is used to integrate ant tool with salesforce and the sample folder contains some example files to practise.

A qucik check whether everything is ready to go:

Download these files from this link and enter your org credentials in build.properties . I have configured it to extract all apex classes and apex triggers from your org.

Open your terminal and go to the location where you have extracted your downloaded file and type the following command 

ant retrive

Your terminal will look something like this 

image

 

Now when you look at your folder structure it will look like this and all your apex classes and apex triggers will be present inside.

A new folder named retrieveOutput has been created.

image

 

Inside retrieveOutput  folder classes folder , triggers folder and package.xml will be present.

image

 

Inside classes folder all your class files and its corresponding meta data information (xml files) will be present.

image

 

Inside triggers folder all your trigger files and its corresponding meta data information (xml files) will be present.

image

 

If you face any errors during your installation process put that in comment section I will help you as soon as possible . 

Rating: 
No votes yet