<style type="text/css">
@import '/css/screen.css' screen;
</style>
- <script src="/js/prettify.js"></script>
<!--[if lt IE 9]>
<script src="/js/html5shiv.js"></script>
<![endif]-->
<![endif]-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
- <body class="menu" onload="prettyPrint()">
+ <body class="menu">
<div id="page" class="cf">
<header id="header">
<h1 id="logo"><a href="/" title="Home" class="l">juplo</a></h1>
Doing so, the only additionally configuration needed, to activat the plugin
is the following entry in the <tt>plugins</tt>-section of your <tt>pom.xml</tt>:
</p>
- <div class="prettyprint linenums lang-html"><pre>
+ <pre>
<plugin>
<groupId>de.juplo</groupId>
<artifactId>hibernate-maven-plugin</artifactId>
</goals>
</execution>
</executions>
-</plugin></pre></div>
+</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
A better approach is, to specify a different url for testing like in the
following snippet:
</p>
- <div class="prettyprint linenums lang-html"><pre>
+ <pre>
<plugin>
<groupId>de.juplo</groupId>
<artifactId>hibernate-maven-plugin</artifactId>
<configuration>
<url><![CDATA[jdbc:mysql://localhost/test-db]]></url>
</configuration>
-</plugin></pre></div>
+</plugin></pre>
<p>
Configuration properties, that are set in the <tt>configuration</tt>-section
of the plugin-configuration cannnot be overwritten elsewere (for details
the plugin-configuration, to be sure to have a separate database for
testing):
</p>
- <div class="prettyprint linenums lang-html"><pre>
+ <pre>
<properties>
<hibernate.connection.driver_class>org.hsqldb.jdbcDriver</hibernate.connection.driver_class>
<hibernate.dialect>org.hibernate.dialect.HSQLDialect</hibernate.dialect>
</configuration>
</plugin>
-<plugins></pre></div>
+<plugins></pre>
</div><div class="section"><h2>Configuration through the plugin-configuration<a name="Configuration_through_the_plugin-configuration"></a></h2>
<p>
A third way for configuring the plugin is the plugin-configuration.
The equivalent of the configuration from the last section would look
like this:
</p>
- <div class="prettyprint linenums lang-html"><pre>
+ <pre>
<plugin>
<groupId>de.juplo</groupId>
<artifactId>hibernate-maven-plugin</artifactId>
<username>sa</username>
<password></password>
</configuration>
-</plugin></pre></div>
+</plugin></pre>
<p>
The parameter <b>hibernateProperties</b> (name of the hibernate-properties-file
to use, defaults to <b>hibernate.properties</b>) can only be configured through
If you need to overwrite plugin-configuration-values with
maven-properties, you can use maven-properties in the plugin-configuration:
</p>
- <div class="prettyprint linenums lang-html"><pre>
+ <pre>
<plugin>
<groupId>de.juplo</groupId>
<artifactId>hibernate-maven-plugin</artifactId>
<configuration>
<password>${my-password-property}</password>
</configuration>
-</plugin></pre></div>
+</plugin></pre>
</div>
</article>
<style type="text/css">
@import '/css/screen.css' screen;
</style>
- <script src="/js/prettify.js"></script>
<!--[if lt IE 9]>
<script src="/js/html5shiv.js"></script>
<![endif]-->
<![endif]-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
- <body class="menu" onload="prettyPrint()">
+ <body class="menu">
<div id="page" class="cf">
<header id="header">
<h1 id="logo"><a href="/" title="Home" class="l">juplo</a></h1>
enabled.
For example, by executing:
</p>
- <div class="prettyprint linenums lang-html"><pre>
-mvn -X compile hibernate:export</pre></div>
+ <pre>
+mvn -X compile hibernate:export</pre>
<p>
(The <tt>compile</tt> might be necessary, because <tt>hibernate-maven-plugin</tt>
has to scan the compiled classes for annotations!)
<style type="text/css">
@import '/css/screen.css' screen;
</style>
- <script src="/js/prettify.js"></script>
<!--[if lt IE 9]>
<script src="/js/html5shiv.js"></script>
<![endif]-->
<![endif]-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
- <body class="menu" onload="prettyPrint()">
+ <body class="menu">
<div id="page" class="cf">
<header id="header">
<h1 id="logo"><a href="/" title="Home" class="l">juplo</a></h1>
you can force it to do so, if you set the parameter <tt>force</tt> to
<tt>true</tt>:
</p>
- <div class="prettyprint linenums lang-html"><pre>
+ <pre>
<plugin>
<groupId>de.juplo</groupId>
<artifactId>hibernate-maven-plugin</artifactId>
<configuration>
<force>true</force>
</configuration>
-</plugin></pre></div>
+</plugin></pre>
<p>
Or you may specify <tt>-Dhibernate.export.force=true</tt> at the command line,
if you want to force hibernate-maven-plugin only once.
<style type="text/css">
@import '/css/screen.css' screen;
</style>
- <script src="/js/prettify.js"></script>
<!--[if lt IE 9]>
<script src="/js/html5shiv.js"></script>
<![endif]-->
<![endif]-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
- <body class="menu" onload="prettyPrint()">
+ <body class="menu">
<div id="page" class="cf">
<header id="header">
<h1 id="logo"><a href="/" title="Home" class="l">juplo</a></h1>
This can be achieved with the command-line parameter
<tt>-Dhibernate.export.target=SCRIPT</tt> or with the following configuration:
</p>
- <div class="prettyprint linenums lang-html"><pre>
+ <pre>
<configuration>
<target>SCRIPT</target>
-</configuration></pre></div>
+</configuration></pre>
<p>
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!
Since it will not be able to see the needed dependency, it will fail with
an error-message like:
</p>
- <div class="prettyprint"><pre>
+ <pre>
[INFO] Gathered hibernate-configuration (turn on debugging for details):
[INFO] hibernate.connection.username = sa
[INFO] hibernate.connection.password =
[INFO] Total time: 2 seconds
[INFO] Finished at: Thu Nov 29 11:31:14 CET 2012
[INFO] Final Memory: 32M/342M
-[INFO] ------------------------------------------------------------------------</pre></div>
+[INFO] ------------------------------------------------------------------------</pre>
<p>
A quick workaround for this error would be, to delete the runtime-constraint
for the jdbc-driver-dependency.
A much cleaner way is, to (additionally) ad the dependency, to the
plugin-definition:
</p>
- <div class="prettyprint linenums lang-html"><pre>
+ <pre>
<plugin>
<groupId>de.juplo</groupId>
<artifactId>hibernate-maven-plugin</artifactId>
<version>2.2.8</version>
</dependency>
</dependencies>
-</plugin></pre></div>
+</plugin></pre>
<p>
This is also the best way, if you use a different jdbc-driver for
testing, than in production.
For example, the dbunit-plugin can be configured to skip its excecution, if
hibernate-maven-plugin was skipped like this:
</p>
- <div class="prettyprint linenums lang-html"><pre>
+ <pre>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>dbunit-maven-plugin</artifactId>
<configuration>
<skip>${hibernate.export.skipped}</skip>
</configuration>
-</plugin></pre></div>
+</plugin></pre>
</div><div class="section"><h2>The database will not be recreated after a manual drop/clean<a name="The_database_will_not_be_recreated_after_a_manual_dropclean"></a></h2>
<p>
If one manually drops the database or removes the hsqldb-files, it will not
unnecessary drop-create-cycle might take a long time. The plugin will
report that like this:
</p>
- <div class="prettyprint"><pre>
+ <pre>
[INFO] No modified annotated classes found and dialect unchanged.
-[INFO] Skipping schema generation!</pre></div>
+[INFO] Skipping schema generation!</pre>
<p>
If one always uses <tt>mvn clean</tt> for cleanup, this will not happen.
Otherwise the recreation must be <a href="./force.html">forced</a>:
</p>
- <div class="prettyprint"><pre>
-mvn hibernate:export -Dhibernate.export.force=true</pre></div>
+ <pre>
+mvn hibernate:export -Dhibernate.export.force=true</pre>
</div><div class="section"><h2>The hibernate:export goal is not executed, when tests are skipped<a name="The_hibernate:export_goal_is_not_executed_when_tests_are_skipped"></a></h2>
<p>
The hibernate-maven-plugin automatically skips its execution, when
<tt>maven.test.skip</tt> is set to <tt>true</tt>. If you need it to be always
executed, you can configure that explicitly like this:
</p>
- <div class="prettyprint linenums lang-html"><pre>
+ <pre>
<plugin>
<groupId>de.juplo</groupId>
<artifactId>hibernate-maven-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
-</plugin></pre></div>
+</plugin></pre>
<p>
Background-information for this design-decission can be found on the extra
page <a href="./skip.html">To skip or not to skip: that is the question</a>...
or set <tt>scanDependencies</tt> to <tt>none</tt> in the configuration
of the plugin like this:
</p>
- <div class="prettyprint linenums lang-html"><pre>
+ <pre>
<plugin>
<groupId>de.juplo</groupId>
<artifactId>hibernate-maven-plugin</artifactId>
<configuration>
<scanDependencies>none</scanDependencies>
</configuration>
-</plugin></pre></div>
+</plugin></pre>
</div><div class="section"><h2>No annotated classes found<a name="No_annotated_classes_found"></a></h2>
<p>
If you are working under Windows and get the error-message
<style type="text/css">
@import '/css/screen.css' screen;
</style>
- <script src="/js/prettify.js"></script>
<!--[if lt IE 9]>
<script src="/js/html5shiv.js"></script>
<![endif]-->
<![endif]-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
- <body class="menu" onload="prettyPrint()">
+ <body class="menu">
<div id="page" class="cf">
<header id="header">
<h1 id="logo"><a href="/" title="Home" class="l">juplo</a></h1>
export-goal, even if the tests are skipped you can configure that explicitly,
by setting the configuration-parameter <tt>skip</tt> to false:
</p>
- <div class="prettyprint linenums lang-html"><pre>
+ <pre>
<plugin>
<groupId>de.juplo</groupId>
<artifactId>hibernate-maven-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
-</plugin></pre></div>
+</plugin></pre>
<p>
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
<tt>skip</tt> to a custom property. For example:
</p>
- <div class="prettyprint linenums lang-html"><pre>
+ <pre>
<plugin>
<groupId>de.juplo</groupId>
<artifactId>hibernate-maven-plugin</artifactId>
<configuration>
<skip>${foo.bar}</skip>
</configuration>
-</plugin></pre></div>
+</plugin></pre>
<p>
This way, the export-goal would be skipped, if you set the property
<tt>foo.bar</tt> to <tt>true</tt>. For example, if you specify <tt>-Dfoo.bar=true</tt>
-Subproject commit e1ecc6b3ea226e2c6c6cbb35b319d4addef0670e
+Subproject commit bd8c879ebaa8a30b257a52fb3db65382f6d004b7