How can I use Maven to get the latest Hibernate release?

James Adams picture James Adams · Aug 5, 2009 · Viewed 68.8k times · Source

I am having trouble getting the latest release of Hibernate via Maven dependency. It appears that the latest I can fetch from a Maven central repository is 3.2.6.GA, and I am interested in using 3.3.2.GA, which is the latest release shown on the hibernate.org site. When I modify my hibernate dependency to this latest version in my project's pom.xml I get the following error when I run a Maven build:

Missing:
----------
1) org.hibernate:hibernate:jar:3.3.2.GA

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.hibernate -DartifactId=hibernate -D
version=3.3.2.GA -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there:

      mvn deploy:deploy-file -DgroupId=org.hibernate -DartifactId=hibernate -Dve
rsion=3.3.2.GA -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[
id]

Once I do that I continue to get errors indicating that I need to add a javassist dependency, then I need to update my hibernate-validator dependency, which also needs to be installed locally, and at that point I stopped and looked around to see if there is a better way, maybe pointing Maven to a JBoss/Hibernate repository, etc. This really seems to be a headache compared to other significant open cource packages that I use such as Spring or JUnit -- when there's a new version released all I do is update the version number in the dependency element and it just works.

I have tried adding the below repository declaration into my pom.xml but with no joy:

<repositories>
    <repository>
        <id>jboss</id>
        <url>http://repository.jboss.org/maven2</url>
    </repository>
</repositories>

I searched Google and didn't find much which helps. Can someone suggest the most straight-forward way of going about using the latest releases of hibernate or hibernate-core (3.3.2.GA), hibernate-validator (3.1.0), and hibernate-annotations (3.4.0)?

Answer

Robert Munteanu picture Robert Munteanu · May 25, 2011

JBoss have started synchronising their own repo with Maven central as posted on the JBoss community blog , therefore hibernate artifacts are now available without the need to add the JBoss repository to your pom.xml or repository manager.

Search result for hibernate-core:

search result for hibernate-core

To add the Hibernate Core 3.6.3 to your project, just add the following snippet to your pom:

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