Using ANT through a proxy server


For those of you who want to use the Apache ANT tool to deploy/retrieve code from salesforce through a proxy server, the following details may be of use to you. I had a look on the Apache ANT site first but it wasn’t immediately obvious to me which of the config files to update.

Anyway after some communication with salesforce support, they provided me with a suitable example. To use ANT through a proxy you’ll need to modify your build.xml file as demonstrarted below (Create the, proxy.port, proxy.user and proxy.pass variables in the file if desired):

<target name="retrieveUnpackaged" depends="proxy">
	<mkdir dir="retrieveUnpackaged"/>
	<sf:retrieve username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" retrieveTarget="retrieveUnpackaged" unpackaged="unpackaged/package.xml"/>

<target name="proxy">
	<property name="" value=""/>
	<property name="proxy.port" value="8080"/>
	<property name="proxy.user" value="myusername"/>
	<property name="proxy.pass" value="mypassword"/>
	<setproxy proxyhost="${}" proxyport="${proxy.port}" proxyuser="${proxy.user}" proxypassword="${proxy.pass}"/>