<dependency>
<groupId>org.hibernate</groupId>
<artifactId>ejb3-persistence</artifactId>
<version>3.3.2.Beta1</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.5.6-Final</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.7.Final</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<repositories>
<repository>
<id>jboss</id>
<name>JBoss repository</name>
<url>http://repository.jboss.org/maven2</url>
</repository>
</repositories>pom.xml文件。
但是我的eclipse不能识别SessionFactory、Session、Transaction、HibernateException等,并给出了编译时错误。如何解决?
发布于 2011-08-28 18:04:50
我不认为您使用的存储库URL是正确的。访问http://repository.jboss.org/maven2时出现403
请看JBoss Maven Getting Started页面上的“配置Maven以使用JBoss存储库”一节。
一旦配置了正确的存储库,请尝试在Eclipse外部构建项目。如果它是构建的,那么您就知道Maven项目配置正确了。
如果在成功构建之后,您的工作区中仍然存在类路径问题,请尝试重新生成eclipse设置文件。
mvn eclipse:clean eclipse:eclipse发布于 2011-08-28 17:26:54
从hibernate 3.6版开始,核心ja包含了注释,所以我不认为注释需要显式依赖。除此之外,你不应该得到编译错误。
https://stackoverflow.com/questions/7220062
复制相似问题