--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ </head>
+ <body>
+ <h2>Configuration through a hibernate.properties-File</h2>
+ <p>
+ The most simple way to configure the plugin is, to put all the
+ hibernate-configuration in a <strong>hibernate.properties</strong>-file on your
+ classpath. Put the file in the <code>resources</code>-folder. Maven will put
+ it in the <code>class</code>-folder of your webapp, where it will be picked up
+ by this plugin as well as by Hibernate 4.
+ </p>
+ <p>
+ Doing so, the only additionally configuration needed, to activat the plugin
+ is the following entry in the <code>plugins</code>-section of your <code>pom.xml</code>:
+ </p>
+ <pre class="prettyprint linenums lang-html">
+<plugin>
+ <groupId>de.juplo</groupId>
+ <artifactId>hibernate-maven-plugin</artifactId>
+ <version>${project.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>export</goal>
+ </goals>
+ </execution>
+ </executions>
+</plugin></pre>
+ <p>
+ 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,
+ <strong>
+ you should never fire up this configuration on your production
+ system, or your database might be erased!
+ </strong>
+ </p>
+ <p>
+ A better approach is, to specify a different url for testing like in the
+ following snippet:
+ </p>
+ <pre class="prettyprint linenums lang-html">
+<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></pre>
+ <p>
+ Configuration properties, that are set in the <code>configuration</code>-section
+ of the plugin-configuration cannnot be overwritten elsewere (for details
+ see <a href="#precedence">Configuration-Method-Precedence</a>).
+ You never can overwrite them by accident when specifying a property on
+ the commandline or in your <code>settings.xml</code>.
+ </p>
+ <h2>Configuration through maven-properties</h2>
+ <p>
+ 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 <a href="./export-mojo.html">Documentation of the export-Mojo</a>).
+ These are named after the
+ <a href="http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html_single/#configuration-hibernatejdbc">Hibernate JDBC Properties</a>:
+ </p>
+ <ul>
+ <li><code>hibernate.connection.driver_class</code></li>
+ <li><code>hibernate.dialect</code></li>
+ <li><code>hibernate.connection.url</code></li>
+ <li><code>hibernate.connection.username</code></li>
+ <li><code>hibernate.connection.password</code></li>
+ </ul>
+ <p>
+ So, instead of writing the hibernate-configuration in the properties-file,
+ like above, you could put it in the <code>properties</code>-section of your
+ <code>pom.xml</code>.
+ </p>
+ <p>
+ 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):
+ </p>
+ <pre class="prettyprint linenums lang-html">
+<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></pre>
+ <h2>Configuration through the plugin-configuration</h2>
+ <p>
+ A third way for configuring the plugin is the plugin-configuration.
+ The relevant configuration-parameters are:
+ </p>
+ <ul>
+ <li><code>driver</code></li>
+ <li><code>dialect</code></li>
+ <li><code>url</code></li>
+ <li><code>username</code></li>
+ <li><code>password</code></li>
+ </ul>
+ <p>
+ The equivalent of the configuration from the last section would look
+ like this:
+ </p>
+ <pre class="prettyprint linenums lang-html">
+<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></pre>
+ <p>
+ The parameter <strong>hibernateProperties</strong> (name of the hibernate-properties-file
+ to use, defaults to <strong>hibernate.properties</strong>) can only be configured through
+ this approach.
+ </p>
+ <p>
+ For more explanations, see the
+ <a href="./export-mojo.html">Documentation of the export-Mojo</a>.
+ </p>
+ <h2 id="precedence">Configuration-Method-Precedence</h2>
+ <p>
+ The configuration is gathered in a fix order:
+ </p>
+ <ol>
+ <li><code>hibernate.properties</code></li>
+ <li><code>hibernate.cfg.xml</code></li>
+ <li><code>persistence.xml</code></li>
+ <li>maven-properties</li>
+ <li>plugin-configuration</li>
+ </ol>
+ <p>
+ If you are in doubt about where a configuration-value comes from, run
+ maven with the <a href="./debugging.html">debug-output</a> enabled: <code>mvn -X hibernate:export</code>
+ and be aware, that maven-properties can be overwitten on the command-line,
+ in your <code>~/.m2/settings.xml</code> and in a profile.
+ </p>
+ <p>
+ 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.
+ </p>
+ <p>
+ If you need to overwrite plugin-configuration-values with
+ maven-properties, you can use maven-properties in the plugin-configuration:
+ </p>
+ <pre class="prettyprint linenums lang-html">
+<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></pre>
+ </body>
+</html>
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ </head>
+ <body>
+ <h1>Hibernate 4 Maven Plugin</h1>
+ <h2>A simple Plugin for generating a Database-Schema from Hibernate 4 Mapping-Annotations</h2>
+ <p>
+ The <strong>hibernate-maven-plugin</strong> 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
+ <a href="http://mojo.codehaus.org/dbunit-maven-plugin">dbunit-maven-plugin</a>.
+ </p>
+ <p>
+ The plugin was designed with three main goals in mind:
+ </p>
+ <ul>
+ <li>It should be easy to use.</li>
+ <li>It should be maximal unlikely, to erase a producation-database by accident.</li>
+ <li>It should not slow down the development cycle.</li>
+ </ul>
+ <p>
+ 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 <a href="./debugging.html">debugging output</a> with the <code>mvn -X ...</code>.
+ </p>
+ <p>
+ 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.
+ </p>
+ <p>
+ 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).
+ </p>
+ <p>
+ For more information about the inspiration to write this tiny plugin,
+ <a href="/hibernate-maven-plugin-a-simple-plugin-for-generating-a-database-schema-from-hibernate-4-mapping-annotations/">read our blog-article about the hibernate-maven-plugin</a>.
+ </p>
+ <h2>Documentation</h2>
+ <ul>
+ <li>
+ See <a href="./configuration.html">Configuration Examples</a> for Usage-Explanations
+ and simple examples of how to use this plugin.
+ </li>
+ <li>
+ See <a href="./export-mojo.html">hibernate:export</a> and
+ <a href="./plugin-info.html">Plugin Documentation</a> for the full
+ autogenerated documentation. These are mostly configuration-options
+ of the Hibernate-Tools <code>SchemaExport</code> and <code>SchemaUpdate</code>, that do
+ the work in the background.
+ </li>
+ </ul>
+ <h2>Releases</h2>
+ <ul>
+ <li><a href="http://juplo.de/hibernate-maven-plugin">current version</a></li>
+ <li>${project.version} (this version)</li>
+ <li><a href="http://juplo.de/hibernate4-maven-plugin-1.0.5">1.0.5</a></li>
+ <li><a href="http://juplo.de/hibernate4-maven-plugin-1.0.4">1.0.4</a></li>
+ <li><a href="http://juplo.de/hibernate4-maven-plugin-1.0.3">1.0.3</a></li>
+ <li><a href="http://juplo.de/hibernate4-maven-plugin-1.0.2">1.0.2</a></li>
+ <li><a href="http://juplo.de/hibernate4-maven-plugin-1.0.1">1.0.1</a></li>
+ <li><a href="http://juplo.de/hibernate4-maven-plugin-1.0">1.0</a></li>
+ </ul>
+ </body>
+</html>