My Ant construct freezes when I try to resolve dependencies using Ivy

I am using Ant 1.9 on Mac 10.7.5 and I just installed Ivy. I have a problem loading dependencies. I have this build.xml file with my Ivy 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 the 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 freezes

 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; working@Daves-MacBook-Pro.local [ivy:retrieve] confs: [default] 

What am I missing to make dependencies resolve and launch my goal?

+4
source share
3 answers

It looks like you are using the default ivy settings. This means that ivy will try to download artifacts from Maven Central (the largest open source Java software repository).

If your solution freezes, it is most likely due to the use of a network proxy. Ivy will try to connect and ultimately time out. Unfortunately, there is an open problem IVY-735 , calling for the ability to specify a timeout. I don't know how long ivy waits by default .....

+1
source

I had a similar problem described in the original Dave post. I checked the internet connection as well as the repository url specified in ivysettings.xml and everything looked fine.

I allowed the ant runtime command to wait in the background while I searched for why the command did not seem to resolve the download URL and within 2 or 3 minutes of waiting, the package started to download.

I'm not sure, but maybe there is some server-side default timeout when the original request is received on the maven repository server.

+1
source

I understand this question is old, but after installing the new mac, I just solved the ivy problem. In my old shell profile, I had:

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

when I work behind a corporate firewall (change xyz-proxy and 8080 as needed).

Trying to figure out where ant hangs (useful: ant -v test ), it obviously freezes when trying to load artifacts on top of https . So instead, I now use:

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

those. define both the https and http proxies (and change xyz-proxy and 8080 again, respectively).

Bingo, now everything works fine.

0
source

Source: https://habr.com/ru/post/1489341/


All Articles