常春藤无法解决依赖关系,而它适用于maven

时间:2012-09-12 13:30:01

标签: maven ivy nexus

我作为 Maven 新手,我正在玩我自己的本地Sonartype Nexus。我已经配置了我的maven安装以将其用作代理,它可以在一个简单的测试项目中解决我pom.xml

中的以下依赖项
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>3.1.2.RELEASE</version>
</dependency> 

接下来,我尝试了一个与 Ivy 相似的项目     

ivy.xml中的

。 Ivy使用相同的Nexus服务器作为代理(在ivysettings.xml中配置)

<ivysettings>
    <settings defaultResolver="default"/>
    <property name="m2-pattern" value="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]" override="false" />
    <resolvers>
        <chain name="default">
            <ibiblio name="public" m2compatible="true" root="http://localhost:2281/nexus/content/groups/public"/>
        </chain>
    </resolvers>
</ivysettings>

但是,在运行ant时,它无法解析hibernate-validator-4.2.0-Final

[ivy:retrieve]
[ivy:retrieve] :: problems summary ::
[ivy:retrieve] :::: WARNINGS
[ivy:retrieve]          module not found: org.hibernate#com.springsource.org.hibernate.validator;4.2.0.Final
[ivy:retrieve]  ==== public: tried
[ivy:retrieve]    http://localhost:2281/nexus/content/groups/public/org/hibernate/com.springsource.org.hibernate.validat
or/4.2.0.Final/com.springsource.org.hibernate.validator-4.2.0.Final.pom
[ivy:retrieve]    -- artifact org.hibernate#com.springsource.org.hibernate.validator;4.2.0.Final!com.springsource.org.hi
bernate.validator.jar:
[ivy:retrieve]    http://localhost:2281/nexus/content/groups/public/org/hibernate/com.springsource.org.hibernate.validat
or/4.2.0.Final/com.springsource.org.hibernate.validator-4.2.0.Final.jar
[ivy:retrieve]          [NOT FOUND  ] javax.activation#activation;1.0.2!activation.jar (0ms)
[ivy:retrieve]  ==== public: tried
[ivy:retrieve]    http://localhost:2281/nexus/content/groups/public/javax/activation/activation/1.0.2/activation-1.0.2.j
ar
[ivy:retrieve]          ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]          ::          UNRESOLVED DEPENDENCIES         ::
[ivy:retrieve]          ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]          :: org.hibernate#com.springsource.org.hibernate.validator;4.2.0.Final: not found
[ivy:retrieve]          ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]
[ivy:retrieve]          ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]          ::              FAILED DOWNLOADS            ::
[ivy:retrieve]          :: ^ see resolution messages for details  ^ ::
[ivy:retrieve]          ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]          :: javax.activation#activation;1.0.2!activation.jar

我已经尝试在Nexus安装中添加更多远程存储库,例如SpringSource Enterprise Bundle Repository (http://maven.springframework.org/release/)或JBoss public(https://repository.jboss.org/nexus/content/repositories/releases/) 但这没有帮助。

原则上,Ivy似乎也能正常工作,因为它在失败之前会获取很多其他依赖项。

我的问题: 1)为什么Maven没有因为同样的原因而失败? hibernate-validator是可选的,Ivy还有另一个解决策略Maven吗?

2)我很想知道它试图解决的工件名称:org.hibernate#com.springsource.org.hibernate.validator;4.2.0.Final    (顺便说一句,如果我添加<dependency org="org.hibernate" name="hibernate-validator" rev="4.2.0.Final" />它可行,但对于Spring案例,    它需要工件com.springsource.org.hibernate.validator

1 个答案:

答案 0 :(得分:1)

好的,解决方案是我错过了将所有新存储库(spring,jboss)分配给公共组存储库/nexus/content/groups/public,该存储库实际上仅作为ivysettings.xml中的存储库提供。