Blog

Using ANT through a proxy server

0

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.host, proxy.port, proxy.user and proxy.pass variables in the build.properties 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> 

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