X-Git-Url: https://juplo.de/gitweb/?p=hibernate4-maven-plugin;a=blobdiff_plain;f=src%2Fsite%2Fxhtml%2Fpitfalls.xhtml;h=3967811bcff10e730e135d067c493eae7dc5290f;hp=50006953f49f302c55157ea5aa97f1fc90454e57;hb=4940080670944a15916c68fb294e18a6bfef12d5;hpb=64900890db2575b7a28790c5e4d5f45083ee94b3 diff --git a/src/site/xhtml/pitfalls.xhtml b/src/site/xhtml/pitfalls.xhtml index 50006953..3967811b 100644 --- a/src/site/xhtml/pitfalls.xhtml +++ b/src/site/xhtml/pitfalls.xhtml @@ -6,14 +6,14 @@

Annotated classes in dependencies are not found.

- hibernate4-maven-plugin by default scans dependencies in the scope + hibernate-maven-plugin by default scans dependencies in the scope compile. You can configure it to scan dependencies in other scopes as well. But it scans only direct dependencies. Transitive dependencies are not scanned for annotated classes. If some of your annotated classes are hidden in a transitive dependency, you can simply add that dependency explicitly.

-

hibernate4-maven-plugin always needs a database-connection

+

hibernate-maven-plugin always needs a database-connection

The default-configuration uses the EXPORT-target of the SchemaExport-Tool. If you do not need to create a database with the evaluated schema, you can @@ -36,7 +36,7 @@ So a tidy maven-developer would usually scope it for runtime.

- But this will break the execution of the hibernate4-maven-plugin. + But this will break the execution of the hibernate-maven-plugin. Since it will not be able to see the needed dependency, it will fail with an error-message like:

@@ -70,7 +70,7 @@
 <plugin>
   <groupId>de.juplo</groupId>
-  <artifactId>hibernate4-maven-plugin</artifactId>
+  <artifactId>hibernate-maven-plugin</artifactId>
   <version>${project.version}</version>
   <executions>
     <execution>
@@ -93,29 +93,29 @@
   Because otherwise, this dependency will unnecessarily bloat the
   runtime-dependencies of your project.
   

-

DBUnit fails after execution of hibernate4 was skipped because nothing has changed

+

DBUnit fails after execution of hibernate was skipped because nothing has changed

- If hibernate4-maven-plugin skips its excecution, this may lead to errors in + If hibernate-maven-plugin skips its excecution, this may lead to errors in other plugins. For example, when importing sample-data in the automatically created database with the help of the dbunit-plugin, the CLEAN_INSERT-operation may fail because of foreign-key-constraints, - if the database was not recreated, because the hibernate4-maven-plugin has + if the database was not recreated, because the hibernate-maven-plugin has skipped its excecution.

A quick fix to this problem is, to force - hibernate4-maven-plugin to export the schema every time it is running. + hibernate-maven-plugin to export the schema every time it is running. But to recreate the database on every testrun may noticeable slow down your development cycle, if you have to wait for slow IO.

- To circumvent this problem, hibernate4-maven-plugin signals a skipped + To circumvent this problem, hibernate-maven-plugin signals a skipped excecution by setting the maven property $\{hibernate.export.skipped\} to true. You can configure other plugins to react on this signal. For example, the dbunit-plugin can be configured to skip its excecution, if - hibernate4-maven-plugin was skipped like this: + hibernate-maven-plugin was skipped like this:

 <plugin>
@@ -128,7 +128,7 @@
   

The database will not be recreated after a manual drop/clean

If one manually drops the database or removes the hsqldb-files, it will not - be recreated by the hibernate4-maven-plugin, because it cannot detect, that + be recreated by the hibernate-maven-plugin, because it cannot detect, that the database needs to be recreated. This happens, because the plugin will not recreate the database if neither the configuration nor the annotated classes have changed, because an @@ -143,17 +143,17 @@ Otherwise the recreation must be forced:

-mvn hibernate4:export -Dhibernate.export.force=true
-

The hibernate4:export goal is not executed, when tests are skipped

+mvn hibernate:export -Dhibernate.export.force=true
+

The hibernate:export goal is not executed, when tests are skipped

- The hibernate4-maven-plugin automatically skips its execution, when + The hibernate-maven-plugin automatically skips its execution, when maven.test.skip is set to true. If you need it to be always executed, you can configure that explicitly like this:

->plugin<
+<plugin>
   <groupId>de.juplo</groupId>
-  <artifactId>hibernate4-maven-plugin</artifactId>
+  <artifactId>hibernate-maven-plugin</artifactId>
   ...
   <configuration>
     <skip>false</skip>
@@ -163,5 +163,34 @@ mvn hibernate4:export -Dhibernate.export.force=true
Background-information for this design-decission can be found on the extra page To skip or not to skip: that is the question...

+

I do not want my dependencies to be scanned for hibernate annotations

+

+ If you do not want your dependencies to be scanned for hibernate annotations, + you can pass -Dhibernate.export.scan_dependencies=none to maven + or set scanDependencies to none in the configuration + of the plugin like this: +

+
+<plugin>
+  <groupId>de.juplo</groupId>
+  <artifactId>hibernate-maven-plugin</artifactId>
+  ...
+  <configuration>
+    <scanDependencies>none</scanDependencies>
+  </configuration>
+</plugin>
+

No annotated classes found

+

+ If you are working under Windows and get the error-message + No annotated classes found in directory C:\projects\X Y Z\path-to-project\target\classes, + but you are really sure, that there are annotated classes in that + directory, you are expiriencing a bug, in the scannotation-library, that + was closed in version 1.1.0 of the hibernate-maven-plugin. +

+

+ + You should consider to upgrade to that version of the plugin. + +