Java Hibernate 3, Maven 2, and pom.xml

Last Modified: Thu, 12 Feb 2009 04:10:00 +0000 ; Created: Thu, 12 Feb 2009 04:10:00 +0000

I decided to try using Hibernate 3 in a Java project managed by Maven. The documentation and public Maven repo for Hibernate were not very good. Even downloading the official Hibernate distribution didn't include all the necessary 3rd party libraries. Below is the dependencies I used for my Maven 2 pom.xml to get Hibernate to work:
      <!-- Hibernate's Core pom distro is lacking since it fails to actually

                  include all dependencies.  We must manually setup the

                  needed dependencies based on the version of Hibernate

                 

                  We get most of these from the complete hibernate-core distribution

                  from hibernate-distribution-X.Y.Z.GA\lib\required\

                 

                  Others you simply have to web search for since Hibernate's

                  documentation simply doesn't provide clear instructions on them.

       -->

      <dependency>

        <groupId>org.hibernate</groupId>

        <artifactId>hibernate-core</artifactId>

        <version>3.3.1.GA</version>

      </dependency>

      <dependency>

        <groupId>antlr</groupId>

        <artifactId>antlr</artifactId>

        <version>2.7.6</version>

      </dependency>

      <dependency>

        <groupId>commons-collections</groupId>

        <artifactId>commons-collections</artifactId>

        <version>3.1</version>

      </dependency>

      <dependency>

        <groupId>dom4j</groupId>

        <artifactId>dom4j</artifactId>

        <version>1.6.1</version>

      </dependency>

      <dependency>

        <groupId>javassist</groupId>

        <artifactId>javassist</artifactId>

        <version>3.4.GA</version>

      </dependency>

      <dependency>

        <groupId>javax.transaction</groupId>

        <artifactId>jta</artifactId>

        <version>1.1</version>

      </dependency>

      <dependency>

        <groupId>org.slf4j</groupId>

        <artifactId>slf4j-api</artifactId>

        <version>1.5.6</version>

      </dependency>

      <dependency>

        <groupId>org.slf4j</groupId>

        <artifactId>slf4j-log4j12</artifactId>

        <version>1.5.6</version>

      </dependency>