Bonjour à tous,
Je suis en train de suivre le tutorial de hibernate, et quand j'exécute la commande maven :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
mvn exec:java -Dexec.mainClass="org.hibernate.tutorial.EventManager" -Dexec.args="store"
J'obtiens l'erreur suivante :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[INFO] [exec:java {execution: default-cli}]
18 [org.hibernate.tutorial.EventManager.main()] INFO org.hibernate.cfg.Environment - Hibernate 3.3.2.GA
20 [org.hibernate.tutorial.EventManager.main()] INFO org.hibernate.cfg.Environment - hibernate.properties not found
24 [org.hibernate.tutorial.EventManager.main()] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
29 [org.hibernate.tutorial.EventManager.main()] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
130 [org.hibernate.tutorial.EventManager.main()] INFO org.hibernate.cfg.Configuration - configuring from resource: /hibernate.cfg.xml
130 [org.hibernate.tutorial.EventManager.main()] INFO org.hibernate.cfg.Configuration - Configuration resource: /hibernate.cfg.xml
Initial SessionFactory creation failed.org.hibernate.HibernateException: /hibernate.cfg.xml not found
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] An exception occured while executing the Java class. null
 
/hibernate.cfg.xml not found
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
Je pense qu'il ne trouve pas le fichier hibernate.cfg.xml car il n'est pas dans le CLASSPATH, mais je ne sais pas comment définir le CLASSPATH comme étant un attribut du plugin maven-exec.
Le fichier hibernate.cfg.xml est bien présent dans le target : /classes/org/hibernate/tutorial/domain.
D'avance merci de votre aide.