hibernate class files are not loading through maven
<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 file.
But My eclipse could not identify SessionFactory, Session,Transaction,HibernateException etc and gives compile time error. how to solve it?
I don't think the repository URL you are using is correct. I get a 403 when accessing http://repository.jboss.org/maven2
Have a look at the section "Configuring Maven to use the JBoss Repository" on the JBoss Maven Getting Started page.
Once you have configured the correct repository try building your project outside of Eclipse. If it builds then you know the Maven project is configured correctly.
If you still have classpath issues inside your workspace after a successful build, try regenerating the eclipse settings files.
mvn eclipse:clean eclipse:eclipse
As of hibernate version 3.6, the core ja contains the annotations, so I don't believe you need an explicit dependency for annotations. Apart from that you shouldn't be getting compilation errors.
精彩评论