Dave
Dave

Reputation: 19110

My Ant build hangs when I try and resolve dependencies using Ivy

I'm using Ant 1.9 on Mac 10.7.5 and I just installed Ivy. I'm having a problem getting dependencies to download. I have this build.xml file with my Ivy resolve target

<project  xmlns:ivy="antlib:org.apache.ivy.ant" name="hello-ivy" default="run">

    <target name="resolve" description="retrieve dependencies with ivy">
        <ivy:retrieve />
    </target>
    ...
    <target name="createSOAPClientJars" depends="resolve">
        <generateSOAPClientJar serviceName="bsexample"
                      wsdlPath="${bsexample.service.wsdl.url}"/>
    </target>

</project>

Then I have this ivy.xml file at the same level as my build.xml file:

<ivy-module version="2.0">
   <info organisation="org.apache" module="hello-ivy"/>
    <dependencies>
            <dependency org="com.sun.xml.ws" name="jaxws-tools" rev="2.1.4"/>
    </dependencies>
</ivy-module>

But when I run my Ant target, everything just hangs

Daves-MacBook-Pro:antws davea$ ant createSOAPClientJars
Buildfile: /Users/davea/antws/build.xml

resolve:
[ivy:retrieve] :: Apache Ivy 2.3.0 - 20130110142753 :: http://ant.apache.org/ivy/ ::
[ivy:retrieve] :: loading settings :: url = jar:file:/opt/apache-ant-1.9.0/lib/ivy-2.3.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
[ivy:retrieve] :: resolving dependencies :: org.apache#hello-ivy;[email protected]
[ivy:retrieve]  confs: [default]

What am I missing in order to get the dependencies to resolve and kickstart my target?

Upvotes: 6

Views: 7947

Answers (3)

Pierre D
Pierre D

Reputation: 26211

I realize this question is kind of old, but I just had an ivy resolution issue today after installing a new mac. In my old shell profile, I had:

export ANT_OPTS="-Dhttp.proxyHost=xyz-proxy -Dhttp.proxyPort=8080"

for when I am working behind the corporate firewall (change xyz-proxy and 8080 as appropriate).

Trying to understand where ant was hanging (useful: ant -v test), it was clearly hanging on trying to download artifacts over https. So instead, I now use:

export ANT_OPTS="-Dhttps.proxyHost=xyz-proxy -Dhttps.proxyPort=8080 -Dhttp.proxyHost=xyz-proxy -Dhttp.proxyPort=8080"

I.e. define both https and http proxy stuff (and again, change xyz-proxy and 8080 as appropriate).

Bingo, now it all works fine.

Upvotes: 0

groxli
groxli

Reputation: 113

I was having a similar issue as describe in Dave's original post. I checked my Internet connection as well as the repository URL listed in ivysettings.xml and everything looked okay.

I was letting the 'ant runtime' command wait in the background while I was looking into why the command didn't seem to resolve to a download URL and in 2 or 3 minutes of waiting, the package downloads started to happen.

I'm not sure, but maybe there is some sort of a default waiting time on the server side when an initial request is received on the maven repository server.

Upvotes: 1

Mark O&#39;Connor
Mark O&#39;Connor

Reputation: 77951

It looks like you're using the default ivy settings. This means ivy will attempt to download artifacts from Maven Central (largest repository of open source java software).

If your resolve is hanging it's most likely due the use of a network proxy. Ivy will attempt to connect and eventually time-out. Unfortunately there is an open issue IVY-735 calling for an ability to specify the time-out. I don't know how long ivy waits by default.....

Upvotes: 2

Related Questions