C'est quand même frustrant de voir que même le tutoriel fourni avec la dernière version de Hibernate (3.6.0) dans le PDF attaché ne fonctionne pas. Tu le fais à la lettre et ça ne marche pas dès le début.
Alors, j'ai configuré le fichier POM comme il faut:
Déja dans Eclipse 3.6 IDE signalait des erreurs dans le POM mais bon, j'ai essayé de lancer Maven via la console (command prompt):
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
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.hibernate.tutorials</groupId> <artifactId>hibernate-tutorial</artifactId> <version>1.0.0-SNAPSHOT</version> <name>First Hibernate Tutorial</name> <build> <!-- we dont want the version to be part of the generated war file name --> <finalName>${project.artifactId}</finalName> </build> <dependencies> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> </dependency> <!-- Because this is a web app, we also have a dependency on the servlet api. --> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> </dependency> <!-- Hibernate uses slf4j for logging, for our purposes here use the simple backend --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> </dependency> <!-- Hibernate gives you a choice of bytecode providers between cglib and javassist --> <dependency> <groupId>javassist</groupId> <artifactId>javassist</artifactId> </dependency> </dependencies> </project>
Il parait que Maven n'arrive pas à trouver les jars nécessaires. Une idée comment faire fonctionner ce 'briant' tuto? Merci davance.
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
17
18
19
20
21
22 mvn compile C:\Documents and Settings\MACHINE_DEV3\My Documents\mvn_prj\hibernate-tutorial>mvn compile [INFO] Scanning for projects... [ERROR] The build could not read 1 project -> [Help 1] [ERROR] [ERROR] The project org.hibernate.tutorials:hibernate-tutorial:1.0.0-SNAPSHOT (C:\Documents and Settings\MAC HINE_DEV3\My Documents\mvn_prj\hibernate-tutorial\pom.xml) has 4 errors [ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-core:jar is missing. @ line 18, colu mn 15 [ERROR] 'dependencies.dependency.version' for javax.servlet:servlet-api:jar is missing. @ line 24, column 15 [ERROR] 'dependencies.dependency.version' for org.slf4j:slf4j-simple:jar is missing. @ line 30, column 15 [ERROR] 'dependencies.dependency.version' for javassist:javassist:jar is missing. @ line 36, column 15 [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/display/MAVEN/ProjectBuildingException C:\Documents and Settings\MACHINE_DEV3\My Documents\mvn_prj\hibernate-tutorial>
Une petite parenthèse. Comme je suis derrière un proxy, j'ai du modifier le fichier 'settings.xml' dans "C:\Documents and Settings\MACHINE_DEV3\.m2":
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13<settings> <proxies> <proxy> <active>true</active> <protocol>http</protocol> <host>XXX.XX.XX.XX</host> <port>80</port> <username>XXXX</username> <password>XXXX</password> </proxy> </proxies> </settings>
Partager