5

我在 Mac 10.7.5 上使用 Ant 1.9,我刚刚安装了 Ivy。我在下载依赖项时遇到问题。我有这个 build.xml 文件和我的 Ivy 解析目标

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

然后我将这个 ivy.xml 文件与我的 build.xml 文件处于同一级别:

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

但是当我运行我的 Ant 目标时,一切都挂了

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]

为了让依赖关系解决并启动我的目标,我缺少什么?

4

3 回答 3

2

看起来您正在使用默认的 ivy 设置。这意味着 ivy 将尝试从 Maven Central(最大的开源 Java 软件存储库)下载工件。

如果您的决心悬而未决,那很可能是由于使用了网络代理。Ivy 将尝试连接并最终超时。不幸的是,有一个未解决的问题IVY-735要求能够指定超时。我不知道ivy默认等待多长时间......

于 2013-07-03T17:17:21.513 回答
1

我遇到了与 Dave 的原始帖子中描述的类似的问题。我检查了我的 Internet 连接以及 ivysettings.xml 中列出的存储库 URL,一切看起来都很好。

我让“ant runtime”命令在后台等待,同时我正在研究为什么该命令似乎没有解析为下载 URL,并且在 2 或 3 分钟的等待中,包下载开始发生。

我不确定,但是当在 Maven 存储库服务器上收到初始请求时,服务器端可能存在某种默认等待时间。

于 2016-08-30T14:40:59.967 回答
0

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.

于 2016-10-14T19:56:35.340 回答