Implemented new parameter "force"
[hibernate4-maven-plugin] / src / main / java / de / juplo / plugins / hibernate4 / Hbm2DdlMojo.java
index 7a5e0af..81cef93 100644 (file)
@@ -110,6 +110,16 @@ public class Hbm2DdlMojo extends AbstractMojo
    */
   private boolean skip;
 
+  /**
+   * Force execution
+   * <p>
+   * Force execution, even if no modified or newly added annotated classes
+   * where found. <code>skip</code> takes precedence over <code>force</code>.
+   *
+   * @parameter expression="${hibernate.export.force}" default-value="false"
+   */
+  private boolean force;
+
   /**
    * SQL-Driver name.
    *
@@ -479,7 +489,7 @@ public class Hbm2DdlMojo extends AbstractMojo
     Target target = null;
     try
     {
-      target = Target.valueOf(this.target);
+      target = Target.valueOf(this.target.toUpperCase());
     }
     catch (IllegalArgumentException e)
     {
@@ -490,7 +500,7 @@ public class Hbm2DdlMojo extends AbstractMojo
     Type type = null;
     try
     {
-      type = Type.valueOf(this.type);
+      type = Type.valueOf(this.type.toUpperCase());
     }
     catch (IllegalArgumentException e)
     {
@@ -507,6 +517,7 @@ public class Hbm2DdlMojo extends AbstractMojo
         !modified
         && !target.equals(Target.SCRIPT)
         && !target.equals(Target.NONE)
+        && !force
       )
     {
       getLog().info("No modified annotated classes found and dialect unchanged.");