From 9ca0b5a7b6e584c790e814278111788dcda0327b Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Fri, 5 May 2017 10:37:41 +0200 Subject: [PATCH] WIP: site? --- src/site/site.xml | 15 ++ src/site/xhtml/getting-started.xhtml | 216 +++++++++++++++++++++++++++ src/site/xhtml/index.xhtml | 70 +++++++++ src/site/xhtml/issue-tracking.xhtml | 13 ++ src/site/xhtml/mail-lists.xhtml | 13 ++ 5 files changed, 327 insertions(+) create mode 100644 src/site/site.xml create mode 100644 src/site/xhtml/getting-started.xhtml create mode 100644 src/site/xhtml/index.xhtml create mode 100644 src/site/xhtml/issue-tracking.xhtml create mode 100644 src/site/xhtml/mail-lists.xhtml diff --git a/src/site/site.xml b/src/site/site.xml new file mode 100644 index 0000000..e06ff91 --- /dev/null +++ b/src/site/site.xml @@ -0,0 +1,15 @@ + + UA-571104-3 + + + + + + + + de.juplo + juplo-maven-skin + 1.0.8 + + + diff --git a/src/site/xhtml/getting-started.xhtml b/src/site/xhtml/getting-started.xhtml new file mode 100644 index 0000000..e8c5afd --- /dev/null +++ b/src/site/xhtml/getting-started.xhtml @@ -0,0 +1,216 @@ + + + + + + +

Configuration through a hibernate.properties-File

+

+ The most simple way to configure the plugin is, to put all the + hibernate-configuration in a hibernate.properties-file on your + classpath. Put the file in the resources-folder. Maven will put + it in the class-folder of your webapp, where it will be picked up + by this plugin as well as by Hibernate 4. +

+

+ 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>export</goal>
+      </goals>
+    </execution>
+  </executions>
+</plugin>
+

+ 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 + the database is droped and recreated by the plugin. + Because of that, + + you should never fire up this configuration on your production + system, or your database might be erased! + +

+

+ 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>export</goal>
+      </goals>
+    </execution>
+  </executions>
+  <configuration>
+    <url><![CDATA[jdbc:mysql://localhost/test-db]]></url>
+  </configuration>
+</plugin>
+

+ Configuration properties, that are set in the configuration-section + of the plugin-configuration cannnot be overwritten elsewere (for details + see Configuration-Method-Precedence). + You never can overwrite them by accident when specifying a property on + the commandline or in your settings.xml. +

+

Configuration through maven-properties

+

+ Alternatively, it is possible, to configure the plugin via maven-properties. + Each relevant configuration-option has a corresponding maven-property + (for a full list see the Documentation of the export-Mojo). + These are named after the + Hibernate JDBC Properties: +

+
    +
  • hibernate.connection.driver_class
  • +
  • hibernate.dialect
  • +
  • hibernate.connection.url
  • +
  • hibernate.connection.username
  • +
  • hibernate.connection.password
  • +
+

+ So, instead of writing the hibernate-configuration in the properties-file, + like above, you could put it in the properties-section of your + pom.xml. +

+

+ Thogether with the plugin-definition from above, the following would + be a complete configuration (again, the database-url was overwritten in + 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>
+
+...
+
+<plugins>
+
+  ...
+
+  <plugin>
+    <groupId>de.juplo</groupId>
+    <artifactId>hibernate-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>
+

Configuration through the plugin-configuration

+

+ A third way for configuring the plugin is the plugin-configuration. + The relevant configuration-parameters are: +

+
    +
  • driver
  • +
  • dialect
  • +
  • url
  • +
  • username
  • +
  • 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>export</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>
+

+ The parameter hibernateProperties (name of the hibernate-properties-file + to use, defaults to hibernate.properties) can only be configured through + this approach. +

+

+ For more explanations, see the + Documentation of the export-Mojo. +

+

Configuration-Method-Precedence

+

+ The configuration is gathered in a fix order: +

+
    +
  1. hibernate.properties
  2. +
  3. hibernate.cfg.xml
  4. +
  5. persistence.xml
  6. +
  7. maven-properties
  8. +
  9. plugin-configuration
  10. +
+

+ If you are in doubt about where a configuration-value comes from, run + maven with the debug-output enabled: mvn -X hibernate:export + and be aware, that maven-properties can be overwitten on the command-line, + in your ~/.m2/settings.xml and in a profile. +

+

+ The plugin-configuration comes last and overwrites everything else. + That way, you can be sure, that a configuration-value, that is + specified in the plugin-configuration will never be overwritten by any + other configuration-method. +

+

+ 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>export</goal>
+      </goals>
+    </execution>
+  </executions>
+  <configuration>
+    <password>${my-password-property}</password>
+  </configuration>
+</plugin>
+ + diff --git a/src/site/xhtml/index.xhtml b/src/site/xhtml/index.xhtml new file mode 100644 index 0000000..a30e6d6 --- /dev/null +++ b/src/site/xhtml/index.xhtml @@ -0,0 +1,70 @@ + + + + + + +

Hibernate 4 Maven Plugin

+

A simple Plugin for generating a Database-Schema from Hibernate 4 Mapping-Annotations

+

+ The hibernate-maven-plugin is a plugin for generating a database-schema + from your Hibernate-4-Mappings and create or update your database + accordingly. + Its main usage is to automatically create and populate a test-database + for unit-tests in cooperation with the + dbunit-maven-plugin. +

+

+ The plugin was designed with three main goals in mind: +

+
    +
  • It should be easy to use.
  • +
  • It should be maximal unlikely, to erase a producation-database by accident.
  • +
  • It should not slow down the development cycle.
  • +
+

+ To achieve the first goal, the convention-over-configuration paradigma + was applied and the plugin was stuffed with usefull logging-messages. + So, if in doubt, just turn on the debugging output with the mvn -X .... +

+

+ To achieve the second goal, the precedence in which the configuration + locations are consulted was layouted in a way that makes it possible, to + prevent overwrites of the wrong database by accident. +

+

+ Last but not least, in order to not slow down the development cycle, the + hibernate-maven-plugin only executes the schema-export, if the mapping + or the dialect changes (or if you force it to do so). +

+

+ For more information about the inspiration to write this tiny plugin, + read our blog-article about the hibernate-maven-plugin. +

+

Documentation

+
    +
  • + See Configuration Examples for Usage-Explanations + and simple examples of how to use this plugin. +
  • +
  • + See hibernate:export and + Plugin Documentation for the full + autogenerated documentation. These are mostly configuration-options + of the Hibernate-Tools SchemaExport and SchemaUpdate, that do + the work in the background. +
  • +
+

Releases

+ + + diff --git a/src/site/xhtml/issue-tracking.xhtml b/src/site/xhtml/issue-tracking.xhtml new file mode 100644 index 0000000..f7e6859 --- /dev/null +++ b/src/site/xhtml/issue-tracking.xhtml @@ -0,0 +1,13 @@ + + + + + + + There is no bug-tracking system set up for this project! +

+ Please send your bug-reports, questions or feature-requests directly + to the developer. +

+ + diff --git a/src/site/xhtml/mail-lists.xhtml b/src/site/xhtml/mail-lists.xhtml new file mode 100644 index 0000000..ff8d7f2 --- /dev/null +++ b/src/site/xhtml/mail-lists.xhtml @@ -0,0 +1,13 @@ + + + + + + + There are no mailinglists defined for this project! +

+ Please send your bug-reports, questions or feature-requests directly + to the developer. +

+ + -- 2.20.1