I got this problem the fist time I tried to compile Hadoop sources. I was behind a network proxy and I wanted an easy way to set it no matter how I run Apache Ant.
That's why I create a new target proxy.setup. A patch was attached to this mail. There is a complete explanation with more flexible options in http://www.linebee.com/?p=142 Regards, Zacarias.
Index: build.xml =================================================================== --- build.xml (revision 915974) +++ build.xml (working copy) @@ -281,7 +281,26 @@ </target> <import file="${test.src.dir}/aop/build/aop.xml"/> + + <property name="proxy.host" value="0.0.0.0" /> + <property name="proxy.port" value="0000" /> + <property name="proxy.user" value="johndoe" /> + <property name="proxy.password" value="johndoe00" /> + <!-- setup proxy for download tasks --> + <condition property="proxy.specified"> + <or> + <isset property="proxy.host" /> + <isset property="proxy.port" /> + <isset property="proxy.user" /> + <isset property="proxy.password" /> + </or> + </condition> + + <target name="proxy.setup" if="proxy.specified"> + <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.user}" proxypassword="${proxy.password}" /> + </target> + <!-- ====================================================== --> <!-- Compile the Java files --> <!-- ====================================================== --> @@ -1361,7 +1380,7 @@ </condition> </target> - <target name="ivy-download" description="To download ivy" unless="offline"> + <target name="ivy-download" description="To download ivy" unless="offline" depends="proxy.setup"> <get src="${ivy_repo_url}" dest="${ivy.jar}" usetimestamp="true"/> </target>