From d2b1e427907be345b4249302aa102fa9527c4ca0 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Mon, 6 Apr 2026 19:02:02 +0200 Subject: [PATCH] Transfomed HTML, that was missinterpred by the parser, into valid markdown --- src/site/markdown/configuration.md | 200 +++++++++++++++-------------- src/site/markdown/debugging.md | 7 +- src/site/markdown/force.md | 21 +-- src/site/markdown/pitfalls.md | 129 +++++++++++-------- src/site/markdown/skip.md | 38 +++--- 5 files changed, 218 insertions(+), 177 deletions(-) diff --git a/src/site/markdown/configuration.md b/src/site/markdown/configuration.md index 41faa259..76f039bf 100644 --- a/src/site/markdown/configuration.md +++ b/src/site/markdown/configuration.md @@ -13,20 +13,22 @@ Doing so, the only additionally configuration needed, to activat the plugin is the following entry in the plugins-section of your pom.xml:

-
-<plugin>
-  <groupId>de.juplo</groupId>
-  <artifactId>hibernate4-maven-plugin</artifactId>
-  <version>${project.version}</version>
-  <executions>
-    <execution>
-      <goals>
-        <goal>export</goal>
-      </goals>
-    </execution>
-  </executions>
-</plugin>
-
+ +``` + + de.juplo + hibernate4-maven-plugin + ${project.version} + + + + export + + + + +``` +

But be aware, that in this case the database-url, that is build in the application is the same that is used while testing, where @@ -41,23 +43,25 @@ A better approach is, to specify a different url for testing like in the following snippet:

-
-<plugin>
-  <groupId>de.juplo</groupId>
-  <artifactId>hibernate4-maven-plugin</artifactId>
-  <version>${project.version}</version>
-  <executions>
-    <execution>
-      <goals>
-        <goal>export</goal>
-      </goals>
-    </execution>
-  </executions>
-  <configuration>
-    <url><![CDATA[jdbc:mysql://localhost/test-db]]></url>
-  </configuration>
-</plugin>
-
+ +``` + + de.juplo + hibernate4-maven-plugin + ${project.version} + + + + export + + + + + + + +``` +

Configuration properties, that are set in the configuration-section of the plugin-configuration cannnot be overwritten elsewere (for details @@ -93,40 +97,41 @@ the plugin-configuration, to be sure to have a separate database for testing):

-
 
-<properties>
-  <hibernate.connection.driver_class>org.hsqldb.jdbcDriver</hibernate.connection.driver_class>
-  <hibernate.dialect>org.hibernate.dialect.HSQLDialect</hibernate.dialect>
-  <hibernate.connection.url><![CDATA[jdbc:hsqldb:res:org.my.path.production_db]]></hibernate.connection.url>
-  <hibernate.connection.username>sa</hibernate.connection.username>
-  <hibernate.connection.password></hibernate.connection.password>
-</properties>
+```
+
+  org.hsqldb.jdbcDriver
+  org.hibernate.dialect.HSQLDialect
+  
+  sa
+  
+
 
 ...
 
-<plugins>
+
 
   ...
 
-  <plugin>
-    <groupId>de.juplo</groupId>
-    <artifactId>hibernate4-maven-plugin</artifactId>
-    <version>${project.version}</version>
-    <executions>
-      <execution>
-        <goals>
-          <goal>export</goal>
-        </goals>
-      </execution>
-    </executions>
-    <configuration>
-      <url><![CDATA[jdbc:hsqldb:target/db/testdb;shutdown=true]]></url>
-    </configuration>
-  </plugin>
-
-<plugins>
-  
+ + de.juplo + hibernate4-maven-plugin + ${project.version} + + + + export + + + + + + + + + +``` +

This way, you can reuse the same properties to provide a default-configurationthe, that is build into your application, and @@ -149,27 +154,29 @@ The equivalent of the configuration from the last section would look like this:

-
-<plugin>
-  <groupId>de.juplo</groupId>
-  <artifactId>hibernate4-maven-plugin</artifactId>
-  <version>${project.version}</version>
-  <executions>
-    <execution>
-      <goals>
-        <goal>export</goal>
-      </goals>
-    </execution>
-  </executions>
-  <configuration>
-    <driverClassName>org.hsqldb.jdbcDriver</driverClassName>
-    <hibernateDialect>org.hibernate.dialect.HSQLDialect</hibernateDialect>
-    <url><![CDATA[jdbc:hsqldb:target/db/fotos;shutdown=true]]></url>
-    <username>sa</username>
-    <password></password>
-  </configuration>
-</plugin>
-
+ +``` + + de.juplo + hibernate4-maven-plugin + ${project.version} + + + + export + + + + + org.hsqldb.jdbcDriver + org.hibernate.dialect.HSQLDialect + + sa + + + +``` +

The parameter hibernateProperties (name of the hibernate-properties-file to use, defaults to hibernate.properties) can only be configured through @@ -206,20 +213,21 @@ If you need to overwrite plugin-configuration-values with maven-properties, you can use maven-properties in the plugin-configuration:

-
-<plugin>
-  <groupId>de.juplo</groupId>
-  <artifactId>hibernate4-maven-plugin</artifactId>
-  <version>${project.version}</version>
-  <executions>
-    <execution>
-      <goals>
-        <goal>export</goal>
-      </goals>
-    </execution>
-  </executions>
-  <configuration>
-    <password>${my-password-property}</password>
-  </configuration>
-</plugin>
-
+ +``` + + de.juplo + hibernate4-maven-plugin + ${project.version} + + + + export + + + + + ${my-password-property} + + +``` diff --git a/src/site/markdown/debugging.md b/src/site/markdown/debugging.md index b2321e13..5e709760 100644 --- a/src/site/markdown/debugging.md +++ b/src/site/markdown/debugging.md @@ -8,8 +8,11 @@ enabled. For example, by executing:

-
-mvn -X compile hibernate4:export
+ +``` +mvn -X compile hibernate4:create +``` +

(The compile might be necessary, because hibernate4-maven-plugin has to scan the compiled classes for annotations!) diff --git a/src/site/markdown/force.md b/src/site/markdown/force.md index b6064132..dd169baf 100644 --- a/src/site/markdown/force.md +++ b/src/site/markdown/force.md @@ -19,15 +19,18 @@ you can force it to do so, if you set the parameter force to true:

-
-<plugin>
-  <groupId>de.juplo</groupId>
-  <artifactId>hibernate4-maven-plugin</artifactId>
-  <version>${project.version}</version>
-  <configuration>
-    <force>true</force>
-  </configuration>
-</plugin>
+ +``` + + de.juplo + hibernate4-maven-plugin + ${project.version} + + true + + +``` +

Or you may specify -Dhibernate.export.force=true at the command line, if you want to force hibernate4-maven-plugin only once. diff --git a/src/site/markdown/pitfalls.md b/src/site/markdown/pitfalls.md index 9cfba8a1..45525896 100644 --- a/src/site/markdown/pitfalls.md +++ b/src/site/markdown/pitfalls.md @@ -20,10 +20,13 @@ This can be achieved with the command-line parameter -Dhibernate.export.target=SCRIPT or with the following configuration:

-
-<configuration>
-  <target>SCRIPT</target>
-</configuration>
+ +``` + + SCRIPT + +``` +

But even when no database is to be created, hibernate always needs to know the dialect. Hence, the plugin will fail if this parameter is missing! @@ -41,7 +44,8 @@ Since it will not be able to see the needed dependency, it will fail with an error-message like:

-
+
+```
 [INFO] Gathered hibernate-configuration (turn on debugging for details):
 [INFO]   hibernate.connection.username = sa
 [INFO]   hibernate.connection.password = 
@@ -59,7 +63,9 @@
 [INFO] Total time: 2 seconds
 [INFO] Finished at: Thu Nov 29 11:31:14 CET 2012
 [INFO] Final Memory: 32M/342M
-[INFO] ------------------------------------------------------------------------
+[INFO] ------------------------------------------------------------------------ +``` +

A quick workaround for this error would be, to delete the runtime-constraint for the jdbc-driver-dependency. @@ -68,26 +74,29 @@ A much cleaner way is, to (additionally) ad the dependency, to the plugin-definition:

-
-<plugin>
-  <groupId>de.juplo</groupId>
-  <artifactId>hibernate4-maven-plugin</artifactId>
-  <version>${project.version}</version>
-  <executions>
-    <execution>
-      <goals>
-        <goal>export</goal>
-      </goals>
-    </execution>
-  </executions>
-  <dependencies>
-  <dependency>
-    <groupId>org.hsqldb</groupId>
-    <artifactId>hsqldb</artifactId>
-    <version>2.2.8</version>
-  </dependency>
-  </dependencies>
-</plugin>
+ +``` + + de.juplo + hibernate4-maven-plugin + ${project.version} + + + + export + + + + + + org.hsqldb + hsqldb + 2.2.8 + + + +``` +

This is also the best way, if you use a different jdbc-driver for testing, than in production. @@ -120,14 +129,16 @@ For example, the dbunit-plugin can be configured to skip its excecution, if hibernate4-maven-plugin was skipped like this:

-
-<plugin>
-  <groupId>org.codehaus.mojo</groupId>
-  <artifactId>dbunit-maven-plugin</artifactId>
-  <configuration>
-    <skip>${hibernate.export.skipped}</skip>
-  </configuration>
-</plugin>
+ +``` + + org.codehaus.mojo + dbunit-maven-plugin + + ${hibernate.export.skipped} + + +``` ## The database will not be recreated after a manual drop/clean @@ -140,15 +151,20 @@ unnecessary drop-create-cycle might take a long time. The plugin will report that like this:

-
+
+```
 [INFO] No modified annotated classes found and dialect unchanged.
-[INFO] Skipping schema generation!
+[INFO] Skipping schema generation! +``` +

If one always uses mvn clean for cleanup, this will not happen. Otherwise the recreation must be forced:

-
-mvn hibernate4:create -Dhibernate.schema.force=true
+ +``` +mvn hibernate4:create -Dhibernate.schema.force=true +``` ## The hibernate:create goal is not executed, when tests are skipped @@ -157,15 +173,18 @@ mvn hibernate4:create -Dhibernate.schema.force=true maven.test.skip is set to true. If you need it to be always executed, you can configure that explicitly like this:

-
-<plugin>
-  <groupId>de.juplo</groupId>
-  <artifactId>hibernate4-maven-plugin</artifactId>
+
+```
+
+  de.juplo
+  hibernate4-maven-plugin
   ...
-  <configuration>
-    <skip>false</skip>
-  </configuration>
-</plugin>
+ + false + + +``` +

Background-information for this design-decission can be found on the extra page To skip or not to skip: that is the question... @@ -179,15 +198,17 @@ mvn hibernate4:create -Dhibernate.schema.force=true or set scanDependencies to none in the configuration of the plugin like this:

-
-<plugin>
-  <groupId>de.juplo</groupId>
-  <artifactId>hibernate4-maven-plugin</artifactId>
+
+```
+
+  de.juplo
+  hibernate4-maven-plugin
   ...
-  <configuration>
-    <scanDependencies>none</scanDependencies>
-  </configuration>
-</plugin>
+ + none + + +``` ## No annotated classes found diff --git a/src/site/markdown/skip.md b/src/site/markdown/skip.md index 989449c4..e7e98fbd 100644 --- a/src/site/markdown/skip.md +++ b/src/site/markdown/skip.md @@ -23,29 +23,35 @@ export-goal, even if the tests are skipped you can configure that explicitly, by setting the configuration-parameter skip to false:

-
-<plugin>
-  <groupId>de.juplo</groupId>
-  <artifactId>hibernate4-maven-plugin</artifactId>
+
+```
+
+  de.juplo
+  hibernate4-maven-plugin
   ...
-  <configuration>
-    <skip>false</skip>
-  </configuration>
-</plugin>
+ + false + + +``` +

Or, if you want the export-goal to be executed by default and to be skipped if you say so, you can bind the value of the configuration-parameter skip to a custom property. For example:

-
-<plugin>
-  <groupId>de.juplo</groupId>
-  <artifactId>hibernate4-maven-plugin</artifactId>
+
+```
+
+  de.juplo
+  hibernate4-maven-plugin
   ...
-  <configuration>
-    <skip>${foo.bar}</skip>
-  </configuration>
-</plugin>
+ + ${foo.bar} + + +``` +

This way, the export-goal would be skipped, if you set the property foo.bar to true. For example, if you specify -Dfoo.bar=true -- 2.39.5