The Force.com Migration Tool is a Java/Ant-based command-line utility for moving metadata between a local directory and a Force.com organization. It runs essentially the same as the Eclipse version but provides a little more granular control.
Setting up Eclipse with Ant.
Initially was getting the following error during the build process "Problem: failed to create task or type". I had to add the ant-saleforce.jar to the Ant runtime classpath (Window > Preferences > Ant > Runtime).
These are instructions for setting up a new project for "Sandbox1"
- Created a new project in Eclipse called "Deploy" for all of the deployment operations.
- Set the salesforce.com username, password and serverurl in the build.properties file.
- Created a folder under src for the sandbox (eg Sandbox1, Sun), so the resulting folder was Deploy/src/Sandbox1.
- In the Sandbox1 folder put package.xml which specifies the components that will be downloaded from the target instance. You can download all or specify the file names for each type. A sample package.xml is below. Objects will be downloaded to src/Sandbox1/src directory.
You can download any files/folders from the target instance and delete them as needed.
When you deploy to the target it using the deployRoot of 'Sandbox1/src', Ant looks at the package.xml file in the 'Sandbox1/src' folder to determine which objects to deploy. It appears that the package must contain a reference to all of the files that are in the directories or else it will fail.
If you try to deploy to one of the sandboxes that doesn't have enough code coverage, then the deploy operation will fail.
To deploy them all to prodcution, just change the build.properties setting and run deployRunAllTests or deployRunNamedTests for the desired sandbox files.
Sample package.xml file