Maven无法下载Hibernate Jars

时间:2012-12-22 14:30:09

标签: eclipse hibernate maven

我在POM中添加了hibernate依赖项,但构建失败,因为它无法解析依赖项。

我仔细检查了设置文件,并在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> 

错误代码(通过eclipse和命令提示符发出相同的错误):

        [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

1 个答案:

答案 0 :(得分:1)

自hibernate 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>