{
builder.append("\n * ");
builder.append(e.getMessage());
+ AbstractSchemaMojo.printStrackTrace(builder, e);
+ builder.append("\n");
}
String error = builder.toString();
getLog().error(error);
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();
+ }
+ }
}