Proxy settings with ivy

30,760

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

Share:
30,760
SMA
Author by

SMA

If you want to talk to me offline, you can contact me on [email protected]

Updated on July 11, 2022

Comments

  • SMA
    SMA almost 2 years

    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.