如何使用 Maven 获取最新的 Hibernate 版本? [英] How can I use Maven to get the latest Hibernate release?
问题描述
我无法通过 Maven 依赖项获取最新版本的 Hibernate.看来我可以从 Maven 中央存储库获取的最新版本是 3.2.6.GA,我有兴趣使用 3.3.2.GA,这是 hibernate.org 网站上显示的最新版本.当我在项目的 pom.xml 中将我的休眠依赖项修改为这个最新版本时,我在运行 Maven 构建时收到以下错误:
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]
一旦我这样做了,我会继续收到错误消息,表明我需要添加一个 javassist 依赖项,然后我需要更新我的 hibernate-validator 依赖项,它也需要在本地安装,然后我停下来环顾四周看看是否有更好的方法,也许将 Maven 指向 JBoss/Hibernate 存储库等.与我使用的其他重要的开源软件包(例如 Spring 或 JUnit)相比,这似乎真的很让人头疼——当有新版本时发布我所做的只是更新依赖元素中的版本号,它就可以工作了.
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.
我尝试将以下存储库声明添加到我的 pom.xml 中,但没有任何乐趣:
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>
我在 Google 上进行了搜索,但没有找到太多帮助.有人可以建议使用最新版本的 hibernate 或 hibernate-core (3.3.2.GA)、hibernate-validator (3.1.0) 和 hibernate-annotations (3.4.0) 的最直接方式吗?
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)?
推荐答案
JBoss 已经开始将他们自己的 repo 与 Maven Central 同步为 发布在 JBoss 社区博客 上,因此 hibernate
工件现在无需添加即可使用JBoss 存储库到您的 pom.xml
或存储库管理器.
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.
要将 Hibernate Core 3.6.3 添加到您的项目中,只需将以下代码段添加到您的 pom 中:
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>
这篇关于如何使用 Maven 获取最新的 Hibernate 版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!