From 851ced4e14fefba16b690155b698e7a39670e196 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 20 Dec 2015 13:32:48 +0100 Subject: [PATCH] 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. --- .../plugins/hibernate/AbstractSchemaMojo.java | 15 +++++++++++++++ .../plugins/hibernate/ModificationTracker.java | 13 +++++++++++++ 2 files changed, 28 insertions(+) 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; -- 2.20.1