Contents[Hide]

Migration Tool needs Apache ANT which requires Java JDK, not JRE which most computers have already.

If you run ANT without JDK then you will get an error:

C:\ant\bin>ant
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\lib\tools.jar
Buildfile: build.xml does not exist!
Build failed

1. Downloading and installing JDK.

Go to: http://www.oracle.com/technetwork/java/javase/downloads/index.html and download Java SE 7 Update 45 JDK 32bit.

Download file jdk-7u45-windows-i586.exe or newer if available and install it.

2. Set the Java path

Right click on My Computer -> Properties ->Advanced settings -> Environment variables... -> System Variables -> New...

Variable name: JAVA_HOME
Variable value for 32bit Windows: C:\Program Files\Java\jdk1.7.0_45
Variable value for 64bit Windows: C:\Program Files (x86)\Java\jdk1.7.0_45

Alternatively you can use console and type (run cmd as adminsitrator!):

set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.7.0_45

3. Get the Apache ANT

Go to ant.apache.org section Binary Distributions and download apache-ant-1.8.4-bin.zip or newer version if available.

Extract content to C: and change folder name to "ant".

4. Set the path for ANT.

Similar as in point 2 add:

Variable name: ANT_HOME
Variable value: C:\ant

Extend "Path" variable by:

;%ANT_HOME%\bin

Alternatively if you prefer console (run cmd as adminsitrator!):

set ANT_HOME=c:\ant
set PATH=%PATH%;%ANT_HOME%\bin

5. Restart computer and test

Restart computer to get patch updated.

Open command line. Start Menu -> cmd and type:

echo %JAVA_HOME%

response:

C:\Program Files (x86)\Java\jdk1.7.0_45

type:

echo %ANT_HOME%

response:

C:\ant\

The it should work, type "ant" you should get:

C:\>ant
Buildfile: build.xml does not exist!
Build failed

It is working.

6. Download Force.com Migration Tool

Log in to your Salesforce and choose Setup -> Build -> Develop -> Tools ->  Force.com Migration Tool, download of salesforce_ant_26.0.zip (3MB) will begin.

Extract it to C:\MirationTool

7. Extend ANT library

Open C:\MirationTool, you will find there "ant-salesforce.jar", copy it to C:\Ant\lib

8. Configure Migration Tool

Go to: C:\MigrationTool\sample

Open file "build.properties" and edit it:

sf.username = This email address is being protected from spambots. You need JavaScript enabled to view it.
sf.password = password + security token

#sf.serverurl = https://login.salesforce.com #for production and dev
sf.serverurl = https://test.salesforce.com #for sandbox

Save it.

9. Test settings

Open command line (Start -> cmd) and type:

cd C:\MigrationTool\sample
ant

You should get:

C:\MigrationTool\sample\ant
Buildfile: C:\MigrationTool\sample\build.xml

test:
[sf:deploy] Request for a deploy submitted successfully.
[sf:deploy] Request Id for the current deploy task: 04sM0000000LtMFIA0
[sf:deploy] Waiting for server to finish processing the request...
[sf:deploy] Request Status: Completed
[sf:deploy] Finished request 04sM0000000LtMFIA0 successfully.
[mkdir] Created dir: D:\Programy\MigrationTool\sample\retrieveOutput
[sf:retrieve] Request for a retrieve submitted successfully.
[sf:retrieve] Request Id for the current retrieve task: 04sM0000000LtCtIAK
[sf:retrieve] Waiting for server to finish processing the request...
[sf:retrieve] Request Status: Completed
[sf:retrieve] Finished request 04sM0000000LtCtIAK successfully.

BUILD SUCCESSFUL
Total time: 47 seconds

It is working!

10. Additional materials:

Force.com Migration Tool
Migration Tool Guide HTML /PDF
Video Deploying Salesforce.com Metadata with ANT
http://www.youtube.com/watch?feature=player_embedded&v=f5UlWurQzHQ#!Force.com Migration Tool may be useful when you move changes from Sandbox to production sysytem.

Go to:

   
© Paweł Woźniak