From: Kai Moritz Date: Wed, 29 Apr 2026 13:37:05 +0000 (+0200) Subject: WIP:Transfomed HTML, that was missinterpred by the parser, into valid markdown X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2F2.1.1;p=hibernate4-maven-plugin WIP:Transfomed HTML, that was missinterpred by the parser, into valid markdown --- diff --git a/src/site/markdown/configuration.md b/src/site/markdown/configuration.md index ffb5fae8..ae9a0bd6 100644 --- a/src/site/markdown/configuration.md +++ b/src/site/markdown/configuration.md @@ -14,40 +14,44 @@ 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>hibernate-maven-plugin</artifactId>
-  <version>${project.version}</version>
-  <executions>
-    <execution>
-      <goals>
-        <goal>create</goal>
-      </goals>
-    </execution>
-  </executions>
-</plugin>
-
+ +``` + + de.juplo + hibernate-maven-plugin + ${project.version} + + + + create + + + + +``` +

This would create the configured database. If you want it to be droped beforehand, you have to add the goal drop:

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

A correspondin goal for the command update is missing in this version, but we are planning to implement it in near feature. @@ -58,13 +62,15 @@ to use. A simple example hibernate.properties-file may look like this:

-
+
+```
 hibernate.dialect=org.hibernate.dialect.H2Dialect
 hibernate.connection.url=jdbc:h2:file:./target/db
 hibernate.connection.driver_class=org.h2.Driver
 hibernate.connection.username=sa
 hibernate.connection.password=
-
+``` +

But be aware, that using this configuration-approach the database-url, that is build in the application is the same that is used while testing, @@ -79,24 +85,26 @@ hibernate.connection.password= A better approach is, to specify a different url for testing like in the following snippet:

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

Configuration properties, that are set in the configuration-section of the plugin-configuration cannnot be overwritten elsewere (for details @@ -190,28 +198,30 @@ hibernate.connection.password= The equivalent of the configuration from the last section would look like this:

-
-<plugin>
-  <groupId>de.juplo</groupId>
-  <artifactId>hibernate-maven-plugin</artifactId>
-  <version>${project.version}</version>
-  <executions>
-    <execution>
-      <goals>
-        <goal>drop</goal>
-        <goal>create</goal>
-      </goals>
-    </execution>
-  </executions>
-  <configuration>
-    <driver>org.hsqldb.jdbcDriver</driver>
-    <dialect>org.hibernate.dialect.HSQLDialect</dialect>
-    <url><![CDATA[jdbc:hsqldb:target/db/fotos;shutdown=true]]></url>
-    <username>sa</username>
-    <password></password>
-  </configuration>
-</plugin>
-
+ +``` + + de.juplo + hibernate-maven-plugin + ${project.version} + + + + drop + create + + + + + 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 @@ -250,21 +260,22 @@ hibernate.connection.password= 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>hibernate-maven-plugin</artifactId>
-  <version>${project.version}</version>
-  <executions>
-    <execution>
-      <goals>
-        <goal>drop</goal>
-        <goal>create</goal>
-      </goals>
-    </execution>
-  </executions>
-  <configuration>
-    <password>${my-password-property}</password>
-  </configuration>
-</plugin>
-
+ +``` + + de.juplo + hibernate-maven-plugin + ${project.version} + + + + drop + create + + + + + ${my-password-property} + + +``` diff --git a/src/site/markdown/debugging.md b/src/site/markdown/debugging.md index f61897c7..aab6e881 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 hibernate:create
+ +``` +mvn -X compile hibernate:create +``` +

(The compile might be necessary, because hibernate-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 8e036a72..9ce1ae10 100644 --- a/src/site/markdown/force.md +++ b/src/site/markdown/force.md @@ -20,15 +20,18 @@ you can force it to do so, if you set the parameter force to true:

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

Or you may specify -Dhibernate.schema.force=true at the command line, if you want to force hibernate-maven-plugin only once. diff --git a/src/site/markdown/pitfalls.md b/src/site/markdown/pitfalls.md index 558c1520..3b0ffe88 100644 --- a/src/site/markdown/pitfalls.md +++ b/src/site/markdown/pitfalls.md @@ -24,10 +24,13 @@ -Dhibernate.schema.execute=false or with the following configuration:

-
-<configuration>
-  <execute>false</execute>
-</configuration>
+ +``` + + false + +``` +

But even when no database is to be created, hibernate always needs to know the dialect. Hence, the plugin will still fail, if this parameter is also @@ -46,7 +49,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 = 
@@ -69,13 +73,15 @@
 [INFO] Finished at: Mon Mar 07 19:06:54 CET 2016
 [INFO] Final Memory: 11M/215M
 [INFO] ------------------------------------------------------------------------
-[ERROR] Failed to execute goal de.juplo:hibernate-maven-plugin:${project.version}:drop (default) on project hibernate4-properties-test: Could not open the JDBC-connection: Unable to load class [org.h2.Driver]: Could not load requested class : org.h2.Driver -> [Help 1]
+[ERROR] Failed to execute goal de.juplo:hibernate-maven-plugin:${project.version}:drop (default) on project hibernate4-properties-test: Could not open the JDBC-connection: Unable to load class [org.h2.Driver]: Could not load requested class : org.h2.Driver -> [Help 1]
 [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/MojoFailureException
+[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException +``` +

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

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

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

-
-<plugin>
-  <groupId>org.codehaus.mojo</groupId>
-  <artifactId>dbunit-maven-plugin</artifactId>
-  <configuration>
-    <skip>${hibernate.schema.skipped}</skip>
-  </configuration>
-</plugin>
+ +``` + + org.codehaus.mojo + dbunit-maven-plugin + + ${hibernate.schema.skipped} + + +``` ## The database will not be recreated after a manual drop/clean @@ -157,15 +168,19 @@ 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 hibernate:create -Dhibernate.schema.force=true
+``` +mvn hibernate:create -Dhibernate.schema.force=true +``` ## The hibernate:create goal is not executed, when tests are skipped @@ -174,15 +189,18 @@ mvn hibernate: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>hibernate-maven-plugin</artifactId>
+
+```
+
+  de.juplo
+  hibernate-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... @@ -196,15 +214,17 @@ mvn hibernate:create -Dhibernate.schema.force=true or set scanDependencies to none in the configuration of the plugin like this:

-
-<plugin>
-  <groupId>de.juplo</groupId>
-  <artifactId>hibernate-maven-plugin</artifactId>
+
+```
+
+  de.juplo
+  hibernate-maven-plugin
   ...
-  <configuration>
-    <scanDependencies>none</scanDependencies>
-  </configuration>
-</plugin>
+ + none + + +``` ## No annotated classes found @@ -236,27 +256,28 @@ mvn hibernate:create -Dhibernate.schema.force=true

Example configuration for two goals:

-
-<executions>
-  <execution>
-    <id>Create Drop-Schema</id>
-    <phase>test-compile</phase>
-    <goals>
-      <goal>drop</goal>
-    </goals>
-    <configuration>
-      <outputFile>db-schema/drop-schema.ddl</outputFile>
-    </configuration>
-  </execution>
-  <execution>
-    <id>Create Create-Schema</id>
-    <phase>test-compile</phase>
-    <goals>
-      <goal>create</goal>
-    </goals>
-    <configuration>
-      <outputFile>db-schema/create-schema.ddl</outputFile>
-    </configuration>
-  </execution>
-</executions>
-
+ +``` + + + Create Drop-Schema + test-compile + + drop + + + db-schema/drop-schema.ddl + + + + Create Create-Schema + test-compile + + create + + + db-schema/create-schema.ddl + + + +``` diff --git a/src/site/markdown/skip.md b/src/site/markdown/skip.md index 109a510f..3753250d 100644 --- a/src/site/markdown/skip.md +++ b/src/site/markdown/skip.md @@ -23,29 +23,35 @@ 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>hibernate-maven-plugin</artifactId>
+
+```
+
+  de.juplo
+  hibernate-maven-plugin
   ...
-  <configuration>
-    <skip>false</skip>
-  </configuration>
-</plugin>
+ + false + + +``` +

Or, if you want the plugin 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>hibernate-maven-plugin</artifactId>
+
+```
+
+  de.juplo
+  hibernate-maven-plugin
   ...
-  <configuration>
-    <skip>${foo.bar}</skip>
-  </configuration>
-</plugin>
+ + ${foo.bar} + + +``` +

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