Adding Hibernate 3.5.x to a maven pom.xml build

旧城冷巷雨未停 提交于 2019-12-03 05:12:33
Pascal Thivent

As seanizer mentioned, the org.hibernate:hibernate:pom:3.5.1-Final artifact is an aggregating modules of type pom (it aggregates the Hibernate Core modules). So you could indeed depend on it by specifying a <type>pom</type>. But I would personally declare a dependency on the wanted module, for example for Hibernate Entity Manager:

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

Or for Hibernate Core:

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

the hibernate artifact is of type pom (meaning it is only a wrapper for other projects). do this:

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate</artifactId>
    <version>3.5.1-Final</version>
    <type>pom</type>
</dependency>

(if you leave out the type, maven will try to resolve the artifact as a jar, which doesn't exist in this case)

This is how I managed to add Hibernate and JPA 2 to my project

. . .

<repositories>
    <repository>
        <id>JBoss</id>
        <name>The "public-jboss" repository group provides a combined view all JBoss community project artifacts</name>
        <layout>default</layout>
        <url>http://repository.jboss.org/nexus/content/groups/public-jboss</url>
    </repository>
</repositories>

<dependencies>

    . . .

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

    . . .

</dependencies>

. . .
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!