1

作为一个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

4

1 回答 1

1

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

于 2012-09-12T14:31:19.360 回答