Proxy settings with ivy
Asked Answered
C

1

19

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.

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>

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>
.  
.  
.  

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.

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.

Cuneiform answered 27/5, 2010 at 13:10 Comment(1)
You can use intellij IDEA debuger to find whats going on, I am doing this to understand how apache spark is downloading jars, found there is BasicURLHandler (github.com/apache/ant-ivy/blob/master/src/java/org/apache/ivy/…) that seems no support proxyExcitant
L
15

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"/>

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

Laverty answered 14/3, 2011 at 1:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.