From 84914605402f375c061542f8946a1a0693fc6996 Mon Sep 17 00:00:00 2001
From: Kai Moritz
This would create the configured database.
@@ -46,21 +49,23 @@ url: /projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/configuration.html
A correspondin goal for the command
But be aware, that using this configuration-approach the database-url,
@@ -100,24 +107,26 @@ hibernate.connection.password=
Configuration properties, that are set in the <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>2.1.2-SNAPSHOT</version> <executions> <execution> <goals> <goal>drop</goal> <goal>create</goal> </goals> </execution> </executions> <configuration> <url><![CDATA[jdbc:hsqldb:target/db/testdb;shutdown=true]]></url> </configuration> </plugin> <plugins>
This way, you can reuse the same properties to provide a
@@ -207,28 +243,30 @@ hibernate.connection.password=
The parameter hibernateProperties (name of the hibernate-properties-file
@@ -280,24 +318,26 @@ hibernate.connection.password=
(The
Or you may specify
But even when no database is to be created, hibernate always needs to know
@@ -59,7 +62,8 @@ url: /projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/pitfalls.html
A quick workaround for this error would be, to delete the runtime-constraint
@@ -101,27 +106,29 @@ url: /projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/pitfalls.html
This is also the best way, if you use a different jdbc-driver for
@@ -159,14 +166,16 @@ url: /projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/pitfalls.html
Hibernate Maven Plugin
Configuration Examples
-<plugin>
- <groupId>de.juplo</groupId>
- <artifactId>hibernate-maven-plugin</artifactId>
- <version>2.1.2-SNAPSHOT</version>
- <executions>
- <execution>
- <goals>
- <goal>create</goal>
- </goals>
- </execution>
- </executions>
-</plugin>
-
-<plugin>
- <groupId>de.juplo</groupId>
- <artifactId>hibernate-maven-plugin</artifactId>
- <version>2.1.2-SNAPSHOT</version>
- <executions>
- <execution>
- <goals>
- <goal>drop</goal>
- <goal>create</goal>
- </goals>
- </execution>
- </executions>
-</plugin>
-
update is missing in this
@@ -75,13 +80,15 @@ url: /projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/configuration.html
+{{< highlight guess >}}
+
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=
-
-<plugin>
- <groupId>de.juplo</groupId>
- <artifactId>hibernate-maven-plugin</artifactId>
- <version>2.1.2-SNAPSHOT</version>
- <executions>
- <execution>
- <goals>
- <goal>drop</goal>
- <goal>create</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <url><![CDATA[jdbc:mysql://localhost/test-db]]></url>
- </configuration>
-</plugin>
-
configuration-section
@@ -162,17 +171,44 @@ hibernate.connection.password=
the plugin-configuration, to be sure to have a separate database for
testing):
-
-<plugin>
- <groupId>de.juplo</groupId>
- <artifactId>hibernate-maven-plugin</artifactId>
- <version>2.1.2-SNAPSHOT</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>
-
-<plugin>
- <groupId>de.juplo</groupId>
- <artifactId>hibernate-maven-plugin</artifactId>
- <version>2.1.2-SNAPSHOT</version>
- <executions>
- <execution>
- <goals>
- <goal>drop</goal>
- <goal>create</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <password>${my-password-property}</password>
- </configuration>
-</plugin>
-Enable Debugging-Output
@@ -18,8 +19,10 @@ url: /projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/debugging.html
-mvn -X compile hibernate:create
compile might be necessary, because hibernate-maven-plugin
@@ -60,8 +63,8 @@ mvn -X compile hibernate:create
-
-
+
+
diff --git a/content/projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/force.html b/content/projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/force.html
index 6debee18..4d03dd5c 100644
--- a/content/projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/force.html
+++ b/content/projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/force.html
@@ -4,6 +4,7 @@ weight: 27
outputs:
- html
url: /projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/force.html
+layout: article
---
Force Execution
@@ -32,15 +33,17 @@ url: /projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/force.html
-<plugin>
- <groupId>de.juplo</groupId>
- <artifactId>hibernate-maven-plugin</artifactId>
- <version>2.1.2-SNAPSHOT</version>
- <configuration>
- <force>true</force>
- </configuration>
-</plugin>
-Dhibernate.schema.force=true at the command line,
@@ -71,8 +74,8 @@ url: /projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/force.html
-
-
+
+
diff --git a/content/projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/pitfalls.html b/content/projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/pitfalls.html
index 88147ecf..9ab3158a 100644
--- a/content/projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/pitfalls.html
+++ b/content/projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/pitfalls.html
@@ -4,6 +4,7 @@ weight: 28
outputs:
- html
url: /projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/pitfalls.html
+layout: article
---
Known Pitfalls (FAQ)
-<configuration>
- <execute>false</execute>
-</configuration>
+{{< highlight guess >}}
+
[INFO] Gathered hibernate-configuration (turn on debugging for details):
[INFO] hibernate.connection.username = sa
[INFO] hibernate.connection.password =
@@ -82,13 +86,14 @@ url: /projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/pitfalls.html
[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:2.1.2-SNAPSHOT: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:2.1.2-SNAPSHOT: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
-<plugin>
- <groupId>de.juplo</groupId>
- <artifactId>hibernate-maven-plugin</artifactId>
- <version>2.1.2-SNAPSHOT</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>
-<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>dbunit-maven-plugin</artifactId>
- <configuration>
- <skip>${hibernate.schema.skipped}</skip>
- </configuration>
-</plugin>The database will not be recreated after a manual drop/clean
@@ -181,9 +190,11 @@ url: /projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/pitfalls.html
+{{< highlight guess >}}
+
[INFO] No modified annotated classes found and dialect unchanged.
-[INFO] Skipping schema generation!
If one always uses mvn clean for cleanup, this will not happen.
@@ -191,8 +202,10 @@ url: /projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/pitfalls.html
-mvn hibernate:create -Dhibernate.schema.force=true
-<plugin>
- <groupId>de.juplo</groupId>
- <artifactId>hibernate-maven-plugin</artifactId>
+{{< highlight guess >}}
+
+
+ de.juplo
+ hibernate-maven-plugin
...
- <configuration>
- <skip>false</skip>
- </configuration>
-</plugin> Background-information for this design-decission can be found on the extra @@ -228,15 +243,17 @@ mvn hibernate:create -Dhibernate.schema.force=true
-<plugin>
- <groupId>de.juplo</groupId>
- <artifactId>hibernate-maven-plugin</artifactId>
+{{< highlight guess >}}
+
+
+ de.juplo
+ hibernate-maven-plugin
...
- <configuration>
- <scanDependencies>none</scanDependencies>
- </configuration>
-</plugin> -<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> -
A business-friendly OSS license
+Can't read the url [http://www.apache.org/licenses/LICENSE-2.0.txt] : Connect timed out
public class CreateMojo extends AbstractSchemaMojo
+{{< highlight guess >}}
+public class CreateMojo extends AbstractSchemaMojo
{
/**
* Output file.
- * <p>
+ *
* If the specified filename is not absolut, the file will be created
* relative to the project build directory
- * (<code>project.build.directory</code>).
+ * (project.build.directory).
*
- * @parameter property="hibernate.schema.create" default-value="create.sql"
+ * @parameter property="hibernate.schema.create" default-value="create.sql"
* @since 1.0
*/
private String outputFile;
@@ -77,7 +79,8 @@ url: /projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/cpd.html
}
};
- tool.getSchemaCreator(config).doCreation(metadata, options, source, target);
You should specify the version in your project's plugin configuration:
<project>
+{{< highlight guess >}}
+
...
- <build>
- <!-- To define the plugin version in your parent POM -->
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>de.juplo</groupId>
- <artifactId>hibernate-maven-plugin</artifactId>
- <version>2.1.2-SNAPSHOT</version>
- </plugin>
+
+
+
+
+
+ de.juplo
+ hibernate-maven-plugin
+ 2.1.2-SNAPSHOT
+
...
- </plugins>
- </pluginManagement>
- <!-- To use the plugin goals in your POM or parent POM -->
- <plugins>
- <plugin>
- <groupId>de.juplo</groupId>
- <artifactId>hibernate-maven-plugin</artifactId>
- <version>2.1.2-SNAPSHOT</version>
- </plugin>
+
+
+
+
+
+ de.juplo
+ hibernate-maven-plugin
+ 2.1.2-SNAPSHOT
+
...
- </plugins>
- </build>
+
+
...
-</project>
- For more information, see "Guide to Configuring Plug-ins"
-<plugin>
- <groupId>de.juplo</groupId>
- <artifactId>hibernate-maven-plugin</artifactId>
+{{< highlight guess >}}
+
+
+ de.juplo
+ hibernate-maven-plugin
...
- <configuration>
- <skip>false</skip>
- </configuration>
-</plugin> Or, if you want the plugin to be executed by default and to be skipped @@ -52,15 +55,17 @@ url: /projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/skip.html
-<plugin>
- <groupId>de.juplo</groupId>
- <artifactId>hibernate-maven-plugin</artifactId>
+{{< highlight guess >}}
+
+
+ de.juplo
+ hibernate-maven-plugin
...
- <configuration>
- <skip>${foo.bar}</skip>
- </configuration>
-</plugin> This way, the plugin would be skipped, if you set the property @@ -92,8 +97,8 @@ url: /projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/skip.html - - + + diff --git a/static/projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/apidocs/allclasses-index.html b/static/projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/apidocs/allclasses-index.html index 4a5d4a2f..7a7503b5 100644 --- a/static/projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/apidocs/allclasses-index.html +++ b/static/projects/hibernate-maven-plugin/2.1.2-SNAPSHOT/apidocs/allclasses-index.html @@ -1,11 +1,11 @@
- +