2012-12-22 73 views
0

我在POM中添加了hibernate依賴關係,但構建失敗,因爲它無法解決依賴關係。Maven無法下載Hibernate Jars

我已經雙重檢查了設置文件,並且還在POM中添加了存儲庫,但仍然收到相同的錯誤。

<dependencies> 
<dependency> 
<groupId>org.hibernate</groupId> 
<artifactId>hibernate-core</artifactId> 
<version>4.1.6.Final</version> 
</dependency> 

    <dependency> 
<groupId>org.hibernate</groupId> 
<artifactId>hibernate-annotations</artifactId> 
<version>3.5.6-Final</version> 
</dependency> 

<dependency> 
<groupId>org.hibernate</groupId> 
<artifactId>hibernate-entitymanager</artifactId> 
<version>3.3.2.GA</version> 
</dependency> 

錯誤代碼(通過蝕相同的錯誤和命令提示):

 [INFO] ------------------------------------------------------------------------ 
     Downloading: https://repository.jboss.org/nexus/content/groups/public-jboss/org/hibernate/hibernate-core/4.1.6.Final/hibernate-core-4.1.6.Final.pom 
     Downloading: https://repository.jboss.org/nexus/content/groups/public-jboss/org/hibernate/hibernate-entitymanager/3.3.2.GA/hibernate-entitymanager-3.3.2.GA.pom 
     [INFO] ------------------------------------------------------------------------ 
     [INFO] BUILD FAILURE 
     [INFO] ------------------------------------------------------------------------ 
     [INFO] Total time: 1.130s 
     [INFO] Finished at: Sat Dec 22 14:23:02 GMT 2012 
     [INFO] Final Memory: 7M/154M 
     [INFO] ------------------------------------------------------------------------ 
     [ERROR] Failed to execute goal on project HibernateMadeEasy: Could not resolve dependencies for project HibernateMadeEasy:HibernateMadeEasy:jar:0.0.1-SNAPSHOT: Failed to collect dependencies for [org.hibernate:hibernate-core:jar:4.1.6.Final (compile), org.hibernate:hibernate-annotations:jar:3.5.6-Final (compile), org.hibernate:hibernate-entitymanager:jar:3.3.2.GA (compile)]: Failed to read artifact descriptor for org.hibernate:hibernate-core:jar:4.1.6.Final: Could not transfer artifact org.hibernate:hibernate-core:pom:4.1.6.Final from/to jboss-public-repository-group (https://repository.jboss.org/nexus/content/groups/public-jboss/): Failed to transfer https://repository.jboss.org/nexus/content/groups/public-jboss/org/hibernate/hibernate-core/4.1.6.Final/hibernate-core-4.1.6.Final.pom. Error code 400, Bad Request -> [Help 1] 
     [ERROR] 
     [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
     [ERROR] Re-run Maven using the -X switch to enable full debug logging. 
     [ERROR] 
     [ERROR] For more information about the errors and possible solutions, please read the following articles: 
     [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException 
+0

它對我有用。你在代理/防火牆後面嗎? – Timo

+0

沒有我不在代理或防火牆後面,是的,它應該工作,因爲鏈接是好的。 –

+0

看起來您已經配置了不需要進入休眠狀態的補充存儲庫,因此它可以通過中央訪問。 – khmarbaise

回答

1

由於冬眠3.5,存在no more hibernate-annotations因爲它被合併到hibernate-core

旁邊,hibernate-entitymanager取決於hibernate-core。包括它會自動下載hibernate-core。所以,爲了簡單起見,您只能包含hibernate-entitymanager

<dependency> 
    <groupId>org.hibernate</groupId> 
    <artifactId>hibernate-entitymanager</artifactId> 
    <version>4.1.6.Final</version> 
</dependency>