X-Git-Url: https://juplo.de/gitweb/?p=hibernate4-maven-plugin;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Fplugins%2Fhibernate4%2FHbm2DdlMojo.java;h=7a5e0af0f1b9b9fb277ff2c077de984fc0b849d8;hp=bc0bc73ad91a362f8effabdfd6adb4f3c25c2225;hb=8a2e08b6409034fd692c4bea72058f785e6802ad;hpb=55a33e35422b904b974a19d3d6368ded60ea1811 diff --git a/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java b/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java index bc0bc73a..7a5e0af0 100644 --- a/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java +++ b/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java @@ -70,6 +70,8 @@ import org.scannotation.AnnotationDB; */ public class Hbm2DdlMojo extends AbstractMojo { + public final static String EXPORT_SKIPPED_PROPERTY = "hibernate.export.skipped"; + public final static String DRIVER_CLASS = "hibernate.connection.driver_class"; public final static String URL = "hibernate.connection.url"; public final static String USERNAME = "hibernate.connection.username"; @@ -205,6 +207,7 @@ public class Hbm2DdlMojo extends AbstractMojo if (skip) { getLog().info("Exectuion of hibernate4-maven-plugin:export was skipped!"); + project.getProperties().setProperty(EXPORT_SKIPPED_PROPERTY, "true"); return; } @@ -458,22 +461,11 @@ public class Hbm2DdlMojo extends AbstractMojo md5s.put(DIALECT, properties.getProperty(DIALECT)); } - if (!modified) - { - getLog().info("No modified annotated classes found and dialect unchanged."); - getLog().info("Skipping schema generation!"); - project.getProperties().setProperty("hibernate.export.skipped", "true"); - return; - } - - getLog().info("Gathered hibernate-configuration (turn on debugging for details):"); if (properties.isEmpty()) { getLog().error("No properties set!"); throw new MojoFailureException("Hibernate-Configuration is missing!"); } - for (Entry entry : properties.entrySet()) - getLog().info(" " + entry.getKey() + " = " + entry.getValue()); Configuration config = new Configuration(); config.setProperties(properties); @@ -507,6 +499,26 @@ public class Hbm2DdlMojo extends AbstractMojo throw new MojoExecutionException("Invalid value for configuration-option \"type\""); } + if (target.equals(Target.SCRIPT) || target.equals(Target.NONE)) + { + project.getProperties().setProperty(EXPORT_SKIPPED_PROPERTY, "true"); + } + if ( + !modified + && !target.equals(Target.SCRIPT) + && !target.equals(Target.NONE) + ) + { + getLog().info("No modified annotated classes found and dialect unchanged."); + getLog().info("Skipping schema generation!"); + project.getProperties().setProperty(EXPORT_SKIPPED_PROPERTY, "true"); + return; + } + + getLog().info("Gathered hibernate-configuration (turn on debugging for details):"); + for (Entry entry : properties.entrySet()) + getLog().info(" " + entry.getKey() + " = " + entry.getValue()); + Connection connection = null; try {