为hibernate 3.6配置pom.xml [英] Configure pom.xml for hibernate 3.6
问题描述
我试着为我的 Spring 3
和配置
应用程序。 pom.xml
Hibernate 3.6
pom.xml
的相关部分如下所示:
<依赖项>
< groupId> mysql< / groupId>
< artifactId> mysql-connector-java< / artifactId>
< version> 5.1.9< / version>
< /依赖关系>
< dependency>
< groupId> org.hibernate< / groupId>
< artifactId> hibernate-core< / artifactId>
< version> 3.6.3.Final< / version>
< /依赖关系>
< dependency>
< groupId> org.javassist< / groupId>
< artifactId> javassist< / artifactId>
< version> 3.17.1-GA< / version>
< /依赖关系>
< dependency>
< groupId> asm< / groupId>
< artifactId> asm-all< / artifactId>
< version> 2.2< / version>
< /依赖关系>
< dependency>
< groupId> antlr< / groupId>
< artifactId> antlr< / artifactId>
< version> 2.7.7< / version>
< /依赖关系>
然而,如果我不包含 javassist.jar
library作为一个外部jar
直接添加到我的构建路径中,我不断收到 java.lang.ClassNotFoundException
。我的 pom.xml
中是否有任何错误,因为它在构建项目时没有下载这个依赖项?
试试 hibernate-entitymanager
而不是 hibernate-core
。
< groupId> org.hibernate< / groupId>
< artifactId> hibernate-entitymanager< / artifactId>
< version> 3.6.3.Final< / version>
< /依赖关系>
这将包含所有必要的依赖关系。检查maven依赖关系层次结构后,您进行此更改。
BTW在maven central中最新的可用hibernate版本是4.1.18
I've tried to configure pom.xml
file for my Spring 3
and Hibernate 3.6
application.
The relevant part of pom.xml
looks like this:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.9</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.3.Final</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.17.1-GA</version>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm-all</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
<version>2.7.7</version>
</dependency>
Nevertheless, if I don't include javassist.jar
library directly to my buildpath as an External jar
, I keep getting java.lang.ClassNotFoundException
. Is there anything wrong in my pom.xml
, due it doesn't download this dependency when building the project?
Try hibernate-entitymanager
instead of hibernate-core
.
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.6.3.Final</version>
</dependency>
This will include all necessary dependencies transitively. Check maven dependency hierarchy after you make this change.
BTW the lastest available version of hibernate in maven central is 4.1.18
这篇关于为hibernate 3.6配置pom.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!