开发者

Ant GET task and proxy

How to use Ant's GET task with proxy?

开发者_StackOverflow

I only see there username and password, but there is no proxy host :(


The key bit in the gettask docs is:

Proxies. Since Apache Ant 1.7.0, Ant running on Java1.5 or later can use the proxy settings of the operating system if enabled with the -autoproxy option. There is also the 'setproxy' task for earlier Java versions. With proxies turned on, requests against localhost may not work as expected, if the request is relayed to the proxy.

So you can use the setproxy task for older versions of Ant, or see the docs on proxy config:

<setproxy proxyhost="firewall" proxyport="81"/>

(The username and password attributes of the gettask are for the remote system, not for intermediate proxies.)


In my case (in Windows cmdline) the only option that actual worked is to precede the call to ant with a set of definitions.
Note that they should not be included in double quotes:

set ANT_OPTS=-Dhttp.proxyHost=proxy.address -Dhttp.proxyPort=proxy.port

with proxy.address and proxy.port replaced by the actual values of course...

I am including this option here because I have also tried the attribute but in a project downloaded from the web I could not locate where to put it! The build files for the project where already prepared and ant get was used but it did not work behind a proxy.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜