常春藤代理设置 [英] Proxy settings with ivy

查看:28
本文介绍了常春藤代理设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,我在内部公司 svn 的 ivy.xml 中定义了依赖项.我可以在没有任何代理任务的情况下访问这个 svn 站点.虽然我的依赖存在于 ibiblio 上,但这是我们公司之外的东西,需要代理才能下载一些东西.我在这里使用常春藤遇到了问题.

I have an issue where in I have defined dependancies in ivy.xml on our internal corporate svn. I am able to access this svn site without any proxy task in ant. While my dependencies resides on ibiblio, that’s something outside our corporate, and needs proxy inorder to download something. I am facing problem using ivy here.

我在 build.xml 中有以下内容

I have following in build.xml

<target name="proxy">  
    <property name="proxy.host" value="xyz.proxy.net"/>  
    <property name="proxy.port" value="8443"/>  
    <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}"/>  
</target>  

<!-- resolve the dependencies of stratus -->
<target name="resolveTestDependency" depends="testResolve, proxy" description="retrieve test dependencies with ivy">
    <ivy:settings file="stratus-ivysettings.xml" />
    <ivy:retrieve conf="test" pattern="${jars}/[artifact]-[revision].[ext]"/><!--pattern here specifies where do you want to download lib to?-->                                          
</target>

<target name=" testResolve ">
    <ivy:settings file="stratus-ivysettings.xml" />
    <ivy:resolve conf="test" file="stratus-ivy.xml"/>
</target>

以下是来自 Stratus-ivysettings.xml 的摘录

Following is the excerpt from stratus-ivysettings.xml

<resolvers>  
    <!-- here you define your file in private machine not on the repo (e.g. jPricer.jar or edgApi.jar)-->  
    <!-- This we will use a url nd not local file system.. -->  
    <url name="privateFS">  
        <ivy pattern="http://xyz.svn.com/ivyRepository/ [organisation]/ivy/ivy.xml"/>                                                    
    </url>  
.  
.  
.  
    <url name="public" m2compatible="true">     
        <artifact pattern="http://www.ibiblio.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/>  
    </url>
.  
.  
.  

所以在这里可以看到获取ivy.xml,我不需要任何代理,因为它在我们自己的网络中,当我设置代理时无法访问.但另一方面,我也在使用 ibiblio,它位于我们网络的外部,仅适用于代理.所以上面的 build.xml 在这种情况下不起作用.有人可以帮忙吗.

So as can be seen here for getting ivy.xml, I don’t need any proxy as its within our own network which cant be accesses when I set proxy. But on the other hand I am using ibiblio as well which is external to our network and works only with proxy. So above build.xml wont work in that case. Can somebody help here.

我在获取 ivy.xml 时不需要代理(就像我有代理一样,ivy 将无法从网络内找到代理后面的 ivy 文件),而且当我的解析器转到公共 url 时我只需要它.

I don’t need proxy while getting ivy.xml (as if I have proxy, ivy wont be able to find ivy file behind proxy from within the network), and I just need it when my resolver goes to public url.

推荐答案

当使用 setproxy 时,使用 nonproxyhosts 属性来指定不应该使用代理的主机for(管道分离).例如,将示例中的 setproxy 任务修改为

When using setproxy, use the nonproxyhosts attribute to specify the hosts that the proxy should not be used for (pipe separated). e.g, modify the setproxy task in your example to

<setproxy proxyhost="${proxy.host}"
          proxyport="${proxy.port}"
          nonproxyhosts="xyz.svn.com"/>

有关详细信息,请参阅 http://ant.apache.org/manual/Tasks/setproxy.html

For more details see http://ant.apache.org/manual/Tasks/setproxy.html

这篇关于常春藤代理设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆