【问题标题】:Why is Ivy unable to resolve spring-test dependency that is visible in my web browser?为什么 Ivy 无法解析在我的 Web 浏览器中可见的 spring-test 依赖项?
【发布时间】:2011-05-26 16:13:42
【问题描述】:

我有一个 ivy.xml 可以成功解析它的所有依赖项,除了以下一个。

<dependency org="org.springframework" name="spring-test" rev="3.0.2.RELEASE" force="true" conf="compile->test"/>

我的 ivysettings.xml 有以下解析器:

<ibiblio name="maven" m2compatible="true" root="http://repo2.maven.org/maven2/"  />

当我尝试解决依赖关系时,我收到以下错误消息:

Server access Error: Connection refused: connect url=http://repo2.maven.org/maven2/org/springframework/spring-test/3.0.2.RELEASE/spring-test-3.0.2.RELEASE.pom

但是,当我在浏览器中导航到该 URL 时,我可以看到 .pom 和 .jars。是什么阻止了 Ivy 解决这种依赖关系?

【问题讨论】:

  • 是的。但我能够毫无问题地检索所有其他 spring-* 依赖项。

标签: ivy dependency-management


【解决方案1】:

听起来确实像是代理问题。

有没有可能之前下载过其他 spring 依赖项(例如,当您在家工作时)并从 ivy 缓存中检索到?

要将 ANT 配置为使用与 Web 浏览器相同的代理,您需要阅读 this web page。总之,使用适当的值设置以下环境变量:

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

【讨论】:

  • 是的。这就是我最终要走的路线。但这似乎只有在 Ivy 的解析和检索是从 Ant 任务中运行时才有效。如果我使用 Eclipse 插件,或者尝试从命令行运行,它似乎没有选择。
  • Eclipse 有自己的机制来设置 HTTP 代理。 eclipsezone.com/eclipse/forums/t45492.html。如果这个答案有帮助,请采纳答案
【解决方案2】:

我在 3.0.5 中遇到了同样的问题,但我没有使用代理。对我来说,解决方法是为发布添加 spring 存储库,因为我的 ivysettings.xml 中只有外部。

ivysettings.xml

<ivysettings>
    <settings defaultResolver="chain"/>
    <resolvers>
        <chain name="chain">
            <ibiblio name="central" m2compatible="true"/>
            <ibiblio name="springsource-external" m2compatible="true" root="http://repository.springsource.com/maven/bundles/external"/>
            <ibiblio name="springsource-release" m2compatible="true" root="http://repository.springsource.com/maven/bundles/release"/>
        </chain>
    </resolvers>
</ivysettings>

【讨论】:

    猜你喜欢
    • 2013-03-31
    • 2018-12-12
    • 2015-09-01
    • 2014-09-16
    • 2014-10-15
    • 2011-12-10
    • 1970-01-01
    • 2011-05-14
    • 2019-12-13
    相关资源
    最近更新 更多