From: Kai Moritz Date: Sun, 20 Dec 2015 12:32:48 +0000 (+0100) Subject: Fixed bug: the execution is no more skipped after a failed build X-Git-Tag: hibernate-maven-plugin-2.0.0~9 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=851ced4e14fefba16b690155b698e7a39670e196;p=hibernate4-maven-plugin Fixed bug: the execution is no more skipped after a failed build After a failed build, further executions of the plugin were skipped, because the MD5-summs suggested, that nothing is to do because nothing has changed. Because of that, the MD5-summs are now removed in case of a failure. --- diff --git a/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java b/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java index 22959683..1eb54e56 100644 --- a/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java +++ b/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java @@ -641,6 +641,21 @@ public abstract class AbstractSchemaMojo extends AbstractMojo thread.setContextClassLoader(contextClassLoader); } } + catch (MojoExecutionException e) + { + tracker.failed(); + throw e; + } + catch (MojoFailureException e) + { + tracker.failed(); + throw e; + } + catch (RuntimeException e) + { + tracker.failed(); + throw e; + } finally { /** Remember mappings and configuration */ diff --git a/src/main/java/de/juplo/plugins/hibernate/ModificationTracker.java b/src/main/java/de/juplo/plugins/hibernate/ModificationTracker.java index 02820693..d9ce624d 100644 --- a/src/main/java/de/juplo/plugins/hibernate/ModificationTracker.java +++ b/src/main/java/de/juplo/plugins/hibernate/ModificationTracker.java @@ -33,6 +33,7 @@ public class ModificationTracker private final Set classNames; private boolean modified = false; + private boolean failed = false; private final File saved; private final MessageDigest digest; @@ -133,6 +134,12 @@ public class ModificationTracker } + void failed() + { + failed = true; + } + + void load() { if (saved.isFile() && saved.length() > 0) @@ -169,6 +176,12 @@ public class ModificationTracker void save() { + if (failed) + { + saved.delete(); + return; + } + if (!modified) return;