将Hibernate 3.5.x添加到maven pom.xml构建中
我将JBoss Maven repo添加到我的pom.xml文件中……
jboss http://repository.jboss.org/maven2/
我这样添加了Hibernate本身……
org.hibernate hibernate 3.5.1-Final
但是当我尝试构建我的应用程序时,我看到了这个错误….
Downloading: http://repository.jboss.org/maven2//org/hibernate/hibernate/3.5.1-Final/hibernate-3.5.1-Final.jar [INFO] Unable to find resource 'org.hibernate:hibernate:jar:3.5.1-Final' in repository jboss (http://repository.jboss.org/maven2/) Downloading: http://repo1.maven.org/maven2/org/hibernate/hibernate/3.5.1-Final/hibernate-3.5.1-Final.jar [INFO] Unable to find resource 'org.hibernate:hibernate:jar:3.5.1-Final' in repository central (http://repo1.maven.org/maven2) [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Failed to resolve artifact. Missing: ---------- 1) org.hibernate:hibernate:jar:3.5.1-Final Try downloading the file manually from the project website. Then, install it using the command: mvn install:install-file -DgroupId=org.hibernate -DartifactId=hibernate -Dversion=3.5.1-Final -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 -Dversion=3.5.1-Final -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id] Path to dependency: 1) stakeholdersupdate:stakeholdersupdate:war:1.0 2) org.hibernate:hibernate:jar:3.5.1-Final ---------- 1 required artifact is missing.
正如seanizer所提到的, org.hibernate:hibernate:pom:3.5.1-Final
artifact是pom
类型的聚合模块(它聚合了Hibernate Core模块)。 所以你确实可以通过指定
来依赖它。 但我个人会声明对所需模块的依赖,例如Hibernate Entity Manager:
org.hibernate hibernate-entitymanager 3.5.1-Final
或者对于Hibernate Core:
org.hibernate hibernate-core 3.5.1-Final
hibernate工件的类型为pom(意味着它只是其他项目的包装器)。 做这个:
org.hibernate hibernate 3.5.1-Final pom
(如果省略类型,maven将尝试将工件解析为jar,在这种情况下不存在)
这就是我设法将Hibernate和JPA 2添加到我的项目中的方法
. . . JBoss The "public-jboss" repository group provides a combined view all JBoss community project artifacts default http://repository.jboss.org/nexus/content/groups/public-jboss . . . org.hibernate hibernate-entitymanager 3.5.5-Final . . . . . .
- Hibernate没有在数据库中保存对象?
- 通过服务API公开Hibernate标准
- 在没有Hibernate Annotations的情况下纠正PostgreSQL文本类型的JPA注释
- 如何避免使用collection fetch指定的警告“firstResult / maxResults; 在内存中应用!“在使用Hibernate时?
- Spring RESTful控制器方法改进建议
- Hibernate返回整数值
- ClassCastException:org.springframework.orm.jpa.EntityManagerHolder无法强制转换为org.springframework.orm.hibernate5.SessionHolder
- 正在加载javassist-ed Hibernate实体
- 尝试访问dao bean时,注入自动连接的依赖项失败