X-Git-Url: https://juplo.de/gitweb/?p=hibernate4-maven-plugin;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Fplugins%2Fhibernate%2FAbstractSchemaMojo.java;h=6f3ff9763ef09bc76f0b352fd4b283efd65040c9;hp=20c326aa036395c88b69fbd4261cb5912a27d6c3;hb=ef0947b306d9515d6af6dbc1fdfd675efcd9eca4;hpb=2bc469097f6ff01d83f7a361d2c33e2a3fafef1c diff --git a/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java b/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java index 20c326aa..6f3ff976 100644 --- a/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java +++ b/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java @@ -733,12 +733,23 @@ public abstract class AbstractSchemaMojo extends AbstractMojo { thread.setContextClassLoader(classLoader); build((MetadataImplementor)metadataBuilder.build(), options, target); + if (handler.getExceptions().size() > 0) + { + StringBuilder builder = new StringBuilder(); + builder.append("Hibernate failed:"); + for (Exception e : handler.getExceptions()) + { + builder.append("\n * "); + builder.append(e.getMessage()); + } + String error = builder.toString(); + getLog().error(error); + throw new MojoFailureException(error); + } } finally { thread.setContextClassLoader(contextClassLoader); - for (Exception e : handler.getExceptions()) - getLog().error(e.getMessage()); /** Track, the content of the generated script */ checkOutputFile(output, tracker); } @@ -1168,7 +1179,7 @@ public abstract class AbstractSchemaMojo extends AbstractMojo { try { - File dir = new File(outputDirectory); + File dir = new File(path); if (dir.exists()) { getLog().info("Adding " + dir.getAbsolutePath() + " to the list of roots to scan...");