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

前端 未结 7 1783
感情败类
感情败类 2020-12-13 04:15

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

7条回答
  •  春和景丽
    2020-12-13 04:48

    You're having problems because org.hibernate:hibernate:3.3.2.GA is an aggregator POM used to build the rest of the modules, it isn't actually a jar. It looks like a refactoring happened after 3.2.7 and that's thrown people off. For reference this blog entry hints at problems they've had promoting Hibernate to central and may explain the change.

    If you look in the JBoss repository, you'll see that the hibernate modules for 3.3.2.GA are hosted, they're just hosted as individual artifacts, hibernate-core, hibernate-ehcache etc. So your repository declaration is correct, you just need to fine tune the dependency declarations to take the change into account.

    The JBoss repository hosts hibernate-annotations-3.4.0.GA, hibernate-validator-3.1.0.GA, and hibernate-core-3.3.2.GA amongst others. Try adding the specific artifacts to your POM and use the JBoss repository as you've already declared.

    There is also a hibernate-dependencies pom that provides transitive dependencies to the majority of hibernate artifacts (including core). So the simplest thing to do would be to replace your existing hibernate dependency declaration with hibernate-dependencies

    Your dependencies would end up like this...

    
      
        org.hibernate
        hibernate-dependencies 
        3.3.2.GA
        pom
        
      
      
        org.hibernate
        hibernate-annotations
        3.4.0.GA
      
      
        org.hibernate
        hibernate-validator
        3.1.0.GA
      
      ...
      
    

    To make your life simpler you could define all these hibernate dependencies in a project say called (hibernate-all), then reference that single project for all your projects that use hibernate (of course it would be nice if the hibernte team provided that project anyway).

提交回复
热议问题