3 * Dependency for driver-class XYZ is missing
5 One regular problem is the scope of the jdbc-driver-dependency.
6 It is very unlikely, that this dependency is needed at compile-time.
7 So a tidy maven-developer would usually scope it for <<<runtime>>>.
9 But this will break the execution of the <<<hibernate4-maven-plugin>>>.
10 Since it will not be able to see the needed dependency, it will fail with
11 an error-message like:
14 [INFO] Gathered hibernate-configuration (turn on debugging for details):
15 [INFO] hibernate.connection.username = sa
16 [INFO] hibernate.connection.password =
17 [INFO] hibernate.dialect = org.hibernate.dialect.HSQLDialect
18 [INFO] hibernate.connection.url = jdbc:hsqldb:/home/kai/mmf/target/mmf;shutdown=true
19 [INFO] hibernate.connection.driver_class = org.hsqldb.jdbcDriver
20 [ERROR] Dependency for driver-class org.hsqldb.jdbcDriver is missing!
21 [INFO] ------------------------------------------------------------------------
23 [INFO] ------------------------------------------------------------------------
24 [INFO] org.hsqldb.jdbcDriver
25 [INFO] ------------------------------------------------------------------------
26 [INFO] For more information, run Maven with the -e switch
27 [INFO] ------------------------------------------------------------------------
28 [INFO] Total time: 2 seconds
29 [INFO] Finished at: Thu Nov 29 11:31:14 CET 2012
30 [INFO] Final Memory: 32M/342M
31 [INFO] ------------------------------------------------------------------------
34 A quick workaround for this error would be, to delete the runtime-constraint
35 for the jdbc-driver-dependency.
37 A much cleaner way is, to (additionally) ad the dependency, to the
42 <groupId>de.juplo</groupId>
43 <artifactId>hibernate4-maven-plugin</artifactId>
44 <version>${project.version}</version>
54 <groupId>org.hsqldb</groupId>
55 <artifactId>hsqldb</artifactId>
56 <version>2.2.8</version>
62 This is also the best way, if you use a different jdbc-driver for
63 testing, than in production.
64 Because otherwise, this dependency will unnecessarily bloat the
65 runtime-dependencies of your project.
67 * DBUnit {fails} after execution of hibernate4 was skipped because nothing has changed
69 If hibernate4-maven-plugin skips its excecution, this may lead to errors in
71 For example, when importing sample-data in the automatically created database
72 with the help of the {{{http://mojo.codehaus.org/dbunit-maven-plugin/}dbunit-plugin}},
73 the <<<CLEAN_INSERT>>>-operation may fail because of foreign-key-constraints,
74 if the database was not recreated, because the hibernate4-maven-plugin has
75 skipped its excecution.
77 A quick fix to this problem is, to {{{./force.html}force}}
78 hibernate4-maven-plugin to export the schema every time it is running.
79 But to recreate the database on every testrun may noticeable slow down your
80 development cycle, if you have to wait for slow IO.
82 To circumvent this problem, hibernate4-maven-plugin signals a skipped
83 excecution by setting the maven property <<<${hibernate.export.skipped}>>> to
85 You can configure other plugins to react on this signal.
86 For example, the dbunit-plugin can be configured to skip its excecution, if
87 hibernate4-maven-plugin was skipped like this:
91 <groupId>org.codehaus.mojo</groupId>
92 <artifactId>dbunit-maven-plugin</artifactId>
94 <skip>${hibernate.export.skipped}</skip>