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=0f143f591f33f11e859823161aac4c99aa815fd9;hp=c9ef2c590c5bf35c3673e8d922cb7d43b7032e92;hb=78e911b4b7571b8fb43ff5d0370f9486107cbeb7;hpb=b5f916e74bbfe359b1ca7e057a43e86fb081eca8 diff --git a/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java b/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java index c9ef2c59..0f143f59 100644 --- a/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java +++ b/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java @@ -741,6 +741,8 @@ public abstract class AbstractSchemaMojo extends AbstractMojo { builder.append("\n * "); builder.append(e.getMessage()); + AbstractSchemaMojo.printStrackTrace(builder, e); + builder.append("\n"); } String error = builder.toString(); getLog().error(error); @@ -1179,12 +1181,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) { @@ -1389,4 +1397,24 @@ public abstract class AbstractSchemaMojo extends AbstractMojo throw new MojoFailureException("Could not find persistence-unit " + persistenceUnit); } + + + public static void printStrackTrace(StringBuilder builder, Throwable t) + { + while (t != null) + { + builder.append("\n\tCause: "); + builder.append(t.getMessage() == null ? "" : t.getMessage().replaceAll("\\s+", " ")); + for (StackTraceElement trace : t.getStackTrace()) + { + builder.append("\n\t"); + builder.append(trace.getClassName()); + builder.append("."); + builder.append(trace.getMethodName()); + builder.append("():"); + builder.append(trace.getLineNumber()); + } + t = t.getCause(); + } + } }