From 149a94d09dfb678e4be39aefb20dbf86ef28c416 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 6 Nov 2016 14:52:37 +0100 Subject: [PATCH] Renemed hibernate.schema.export to hibernate.schema.execute --- src/it/dependency test/h4mp/pom.xml | 2 +- src/it/h4mp-mod/pom.xml | 2 +- src/it/hib-test/pom.xml | 2 +- .../README.md | 2 +- .../pom.xml | 2 +- src/it/ignored-dependency/main/pom.xml | 2 +- src/it/multimodule/shared/pom.xml | 2 +- src/it/multiple-persistence-units/pom.xml | 2 +- src/it/properties/pom.xml | 2 +- src/it/tutorials/osgi/managed-jpa/pom.xml | 2 +- .../plugins/hibernate/AbstractSchemaMojo.java | 27 +++++++++---------- src/site/xhtml/force.xhtml | 5 ++-- src/site/xhtml/index.xhtml | 7 +++-- src/site/xhtml/pitfalls.xhtml | 13 +++++---- 14 files changed, 35 insertions(+), 37 deletions(-) diff --git a/src/it/dependency test/h4mp/pom.xml b/src/it/dependency test/h4mp/pom.xml index 8d548fd1..6071105d 100644 --- a/src/it/dependency test/h4mp/pom.xml +++ b/src/it/dependency test/h4mp/pom.xml @@ -72,7 +72,7 @@ primary - false + false true true ; diff --git a/src/it/h4mp-mod/pom.xml b/src/it/h4mp-mod/pom.xml index 7220a74d..948dbf53 100644 --- a/src/it/h4mp-mod/pom.xml +++ b/src/it/h4mp-mod/pom.xml @@ -66,7 +66,7 @@ - false + false true true ; diff --git a/src/it/hib-test/pom.xml b/src/it/hib-test/pom.xml index 25ee7a97..b7bc4cb9 100644 --- a/src/it/hib-test/pom.xml +++ b/src/it/hib-test/pom.xml @@ -46,7 +46,7 @@ @project.version@ - false + false true diff --git a/src/it/hibernate4-maven-plugin-envers-sample/README.md b/src/it/hibernate4-maven-plugin-envers-sample/README.md index 792ecc6d..800e70e7 100644 --- a/src/it/hibernate4-maven-plugin-envers-sample/README.md +++ b/src/it/hibernate4-maven-plugin-envers-sample/README.md @@ -30,7 +30,7 @@ Usage __Rebuild the SQL-script using the Hibernate4-maven-plugin to create the database__ - mvn -PcreateHsqlDbScript clean compile hibernate:export + mvn -PcreateHsqlDbScript clean compile hibernate:create __Build and run the integration tests__ diff --git a/src/it/hibernate4-maven-plugin-envers-sample/pom.xml b/src/it/hibernate4-maven-plugin-envers-sample/pom.xml index c77f3b39..9880d513 100644 --- a/src/it/hibernate4-maven-plugin-envers-sample/pom.xml +++ b/src/it/hibernate4-maven-plugin-envers-sample/pom.xml @@ -203,7 +203,7 @@ - false + false org.hsqldb.jdbc.JDBCDriver org.hibernate.dialect.HSQLDialect true diff --git a/src/it/ignored-dependency/main/pom.xml b/src/it/ignored-dependency/main/pom.xml index 1dab9a54..32603c3b 100644 --- a/src/it/ignored-dependency/main/pom.xml +++ b/src/it/ignored-dependency/main/pom.xml @@ -40,7 +40,7 @@ - false + false true false org.hibernate.dialect.PostgreSQL9Dialect diff --git a/src/it/multimodule/shared/pom.xml b/src/it/multimodule/shared/pom.xml index 2323bd21..513633f1 100644 --- a/src/it/multimodule/shared/pom.xml +++ b/src/it/multimodule/shared/pom.xml @@ -120,7 +120,7 @@ ch.dvbern.demo.persistence.DemoPhysicalNamingStrategyImpl - false + false true true diff --git a/src/it/multiple-persistence-units/pom.xml b/src/it/multiple-persistence-units/pom.xml index 1ceb830c..0bc972ff 100644 --- a/src/it/multiple-persistence-units/pom.xml +++ b/src/it/multiple-persistence-units/pom.xml @@ -68,7 +68,7 @@ - false + false true diff --git a/src/it/properties/pom.xml b/src/it/properties/pom.xml index ac24f7f5..833a43a4 100644 --- a/src/it/properties/pom.xml +++ b/src/it/properties/pom.xml @@ -36,7 +36,7 @@ @project.version@ - false + false diff --git a/src/it/tutorials/osgi/managed-jpa/pom.xml b/src/it/tutorials/osgi/managed-jpa/pom.xml index 6aa0cc30..b1ac0d85 100644 --- a/src/it/tutorials/osgi/managed-jpa/pom.xml +++ b/src/it/tutorials/osgi/managed-jpa/pom.xml @@ -82,7 +82,7 @@ jdbc:h2:mem:db1;MVCC=TRUE true - false + false diff --git a/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java b/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java index 922b77db..6f224b09 100644 --- a/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java +++ b/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java @@ -88,7 +88,7 @@ import org.scannotation.AnnotationDB; */ public abstract class AbstractSchemaMojo extends AbstractMojo { - public final static String EXPORT = "hibernate.schema.export"; + public final static String EXECUTE = "hibernate.schema.execute"; public final static String OUTPUTDIRECTORY = "project.build.outputDirectory"; public final static String SCAN_CLASSES = "hibernate.schema.scan.classes"; public final static String SCAN_DEPENDENCIES = "hibernate.schema.scan.dependencies"; @@ -127,7 +127,7 @@ public abstract class AbstractSchemaMojo extends AbstractMojo /** Parameters to configure the genaration of the SQL *********************/ /** - * Export the database-schma to the database. + * Excecute the generated SQL. * If set to false, only the SQL-script is created and the * database is not touched. *

@@ -137,10 +137,10 @@ public abstract class AbstractSchemaMojo extends AbstractMojo * it is not known by Hibernate nor JPA and, hence, not picked up from * their configuration! * - * @parameter property="hibernate.schema.export" default-value="true" + * @parameter property="hibernate.schema.execute" default-value="true" * @since 2.0 */ - private Boolean export; + private Boolean execute; /** * Skip execution @@ -165,10 +165,11 @@ public abstract class AbstractSchemaMojo extends AbstractMojo private boolean skip; /** - * Force execution + * Force generation/execution *

- * Force execution, even if no modified or newly added annotated classes - * where found and the dialect was not changed. + * Force the generation and (if configured) the execution of the SQL, even if + * no modified or newly added annotated classes where found and the + * configuration was not changed. *

* skip takes precedence over force. *

@@ -627,11 +628,9 @@ public abstract class AbstractSchemaMojo extends AbstractMojo /** Skip execution, if mapping and configuration is unchanged */ if (!tracker.modified()) { - getLog().info( - "Mapping and configuration unchanged." - ); + getLog().info("Mapping and configuration unchanged."); if (force) - getLog().info("Schema generation is forced!"); + getLog().info("Generation/execution is forced!"); else { getLog().info("Skipping schema generation!"); @@ -696,7 +695,7 @@ public abstract class AbstractSchemaMojo extends AbstractMojo SchemaManagementToolCoordinator .buildExecutionOptions(settings, handler); final EnumSet targetTypes = EnumSet.of(TargetType.SCRIPT); - if (export) + if (execute) targetTypes.add(TargetType.DATABASE); TargetDescriptor target = new TargetDescriptor() { @@ -916,10 +915,10 @@ public abstract class AbstractSchemaMojo extends AbstractMojo throws MojoFailureException { /** - * Special treatment for the configuration-value "export": if it is + * Special treatment for the configuration-value "execute": if it is * switched to "true", the genearation fo the schema should be forced! */ - if (tracker.check(EXPORT, export.toString()) && export) + if (tracker.check(EXECUTE, execute.toString()) && execute) tracker.touch(); /** diff --git a/src/site/xhtml/force.xhtml b/src/site/xhtml/force.xhtml index 4e4fdcbb..ee3586f7 100644 --- a/src/site/xhtml/force.xhtml +++ b/src/site/xhtml/force.xhtml @@ -9,8 +9,9 @@ The hibernate-maven-plugin computes MD5-sums for all found annotated classes and stores them together with the generated schema. If no classes were changed or added and the dialect wasn't changed too, it - automatically skips the configured schema-export, to speed up the development - cycle. + automatically skips the configured SQL-generation — and more + important in this respect — the execution of the generated SQL, + to speed up the development cycle.

The plugin signals, that the execution was skipped by setting the maven diff --git a/src/site/xhtml/index.xhtml b/src/site/xhtml/index.xhtml index ff1ca5ef..65324755 100644 --- a/src/site/xhtml/index.xhtml +++ b/src/site/xhtml/index.xhtml @@ -34,8 +34,8 @@

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). + hibernate-maven-plugin only executes the generated SQL, if the mapping + or the configuration has changed (or if you force it to do so).

For more information about the inspiration to write this tiny plugin, @@ -52,8 +52,7 @@ See hibernate:drop 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. + from the Hibernate-Tooling, that does the work in the background.

Releases

diff --git a/src/site/xhtml/pitfalls.xhtml b/src/site/xhtml/pitfalls.xhtml index 3d8c6164..a8eb5ab7 100644 --- a/src/site/xhtml/pitfalls.xhtml +++ b/src/site/xhtml/pitfalls.xhtml @@ -16,20 +16,19 @@

hibernate-maven-plugin always needs a database-connection

- The default-configuration exports the created schema to the configured - database. + The default-configuration executes the created SQL. Therefore, it needs a valid database-connection and fails, if none is available. - If you do not need to export the created schema to a database, - you can set the property hibernate.schema.export to + If you do not need the generated SQL to be executed automatically, + you can set the property hibernate.schema.execute to false. This can be achieved with the command-line parameter - -Dhibernate.schema.export=false or with the following + -Dhibernate.schema.execute=false or with the following configuration:

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

But even when no database is to be created, hibernate always needs to know @@ -124,7 +123,7 @@

A quick fix to this problem is, to force - hibernate-maven-plugin to export the schema every time it is running. + hibernate-maven-plugin to generate and execute the SQL every time it is running. But to recreate the database on every testrun may noticeable slow down your development cycle, if you have to wait for slow IO.

-- 2.20.1