2012-09-12 210 views
1

我作爲Maven新手,我玩弄我自己的本地Sonartype Nexus。我已經配置我的Maven安裝使用它作爲一個代理,它工作正常進行簡單的測試項目在我pom.xml常春藤無法解決依賴項,而它與maven

<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-context</artifactId> 
    <version>3.1.2.RELEASE</version> 
</dependency> 

下一頁解決以下幾個依賴,我嘗試過類似的項目具有

常春藤

ivy.xml。常春藤使用相同的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/) ,但是這樣做沒有幫助。

原則上,常春藤似乎可以正常工作,並且在發生故障之前獲取很多其他依賴關係。

我的問題: 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" />它的工作原理,但春節時, 它需要人爲com.springsource.org.hibernate.validator

回答

1

好了,解決的辦法是我錯過了將所有新存儲庫(spring,jboss)分配給公共組資源庫/nexus/content/groups/public,這些資源庫實際上僅作爲ivysettings.xml中的存儲庫。