Ant 设置http代理

0个评论

在编译Harmony的时候,经常需要去fetch依赖,但是服务器本身不能够上外网,因此只能通过代理的方式去下载这些依赖~

 

1 export ANT_OPTS="-Dhttp.proxyHost=host -Dhttp.proxyPort=port -Dhttp.proxyUserName=username -Dhttp.proxyPassword=password" 
2  
3 //其中username、password、host、port用具体值替换。当然如果密码有不规则字符要小心,该转义的要转义。
1 //如果是需要用到https代理的话,需要将上面的-Dhttp改为-Dhttps即可

或者编辑build.xml文件添加一个target

<target name="proxy">
            <property name="proxy.host" value="。。"/>
            <property name="proxy.port" value="。。"/>
            <property name="proxy.user" value="。。"/> 
            <property name="proxy.pass" value="。。"/> 
            <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.user}" proxypassword="${proxy.pass}"/> 
            </target>
  <target name="ivy-download" description="To download ivy " unless="offline" depends="proxy">
    <get src="${ivy_repo_url}" dest="${ivy.jar}" usetimestamp="true"/>
  </target>


让别的需要下载文件的target去引用它就行了。

depends="proxy"

相关文章:

  • 2022-12-23
  • 2022-02-03
  • 2021-05-28
  • 2021-06-10
  • 2021-07-19
  • 2021-10-13
  • 2022-12-23
猜你喜欢
  • 2021-09-14
  • 2021-07-04
  • 2021-12-24
  • 2021-08-20
  • 2021-09-24
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案