X-Git-Url: http://juplo.de/gitweb/?p=hibernate4-maven-plugin;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Fplugins%2Fhibernate%2FAbstractSchemaMojo.java;h=28260f0684f96a13339a2992453fe726f8887e60;hp=20c326aa036395c88b69fbd4261cb5912a27d6c3;hb=2af1ce0850ce7d29966072b750c53c144fb8f295;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..28260f06 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,12 +1179,18 @@ 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..."); urls.add(dir.toURI().toURL()); } + else + getLog().warn( + "the directory cannot be scanned for annotated classes, " + + "because it does not exist: " + + dir.getAbsolutePath() + ); } catch (MalformedURLException e) {