Newer Version Available
Deploying Code
You can deploy metadata components and Apex at the same time, but you may find it useful to create separate targets for deploying Apex, so that you can run tests as part of the deployment. A portion of a build.xml file is listed below, with a target named deployCode that deploys the contents of the codepkg package and runs the tests for one class.
1<target name="deployCode">
2 <sf:deploy
3 username="${sf.username}"
4 password="${sf.password}"
5 sessionId="${sf.sessionId}"
6 serverurl="${sf.serverurl}"
7 deployroot="codepkg">
8 <runTest>SampleDeployClass</runTest>
9 </sf:deploy>
10</target>