Hi all,
In eclipse I created a simple maven project (without archetype) named "hibernate-tutorial", and import the tutorial code into the project from the follow link:
http://docs.jboss.org/hibernate/core/3. ... orials.zipAfter importing, the hierarchy of the project is as follows:
hibernate-tutorial
src/main/java (empty)
src/main/resources (empty)
src/test/java (empty)
src/test/resources (empty)
JRE System Library
Maven Dependencies
annotation (tutorial code)
basic (tutorial code)
entitymanager (tutorial code)
envers (tutorial code)
src (tutorial code)
pom.xml (tutorial code)
I used maven 3.0.3 and jdk 1.6.0_27 to build the tutorial code (mvn clean, mvn install) but got a build failure:
=======================================
Running org.hibernate.tutorial.hbm.NativeApiIllustrationTest
122 [main] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.2.0.Final
129 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.6.3.Final
131 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
134 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
138 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
205 [main] INFO org.hibernate.cfg.Configuration - configuring from resource: /hibernate.cfg.xml
205 [main] INFO org.hibernate.cfg.Configuration - Configuration resource: /hibernate.cfg.xml
274 [main] INFO org.hibernate.cfg.Configuration - Reading mappings from resource : org/hibernate/tutorial/hbm/Event.hbm.xml
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.35 sec <<< FAILURE!
Results :
Tests in error:
testBasicUsage(org.hibernate.tutorial.hbm.NativeApiIllustrationTest): resource: org/hibernate/tutorial/hbm/Event.hbm.xml not found
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Hibernate Getting Started Guide Tutorials ......... SUCCESS [0.487s]
[INFO] Hibernate hbm.xml Tutorial ........................ FAILURE [2.381s]
[INFO] Hibernate Annotations Tutorial .................... SKIPPED
[INFO] Hibernate JPA Tutorial ............................ SKIPPED
[INFO] Hibernate Envers Tutorial ......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.021s
[INFO] Finished at: Fri Oct 14 19:33:46 PDT 2011
[INFO] Final Memory: 15M/212M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.7.2:test (default-test) on project hibernate-tutorial-hbm: There are test failures.
[ERROR]
[ERROR] Please refer to /workspace/nmtg_platform_comp/hibernate-tutorial/basic/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/disp ... eException[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :hibernate-tutorial-hbm
===================================================
I did try "mvn clean install -rf :hibernate-tutorial-hbm" but still didn't work.
Can anyone tell me how to run the example code in eclipse, and how to use the resultant jar? As a newbie of Hibernate, I just want to see how it works at this point.
Thanks a lot; any suggestion will be highly appreciated.
-yrliu