X-Git-Url: https://juplo.de/gitweb/?p=hibernate4-maven-plugin;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Fplugins%2Fhibernate4%2FHbm2DdlMojo.java;h=f66f52495fd12914fd1dfbcfafe3a59a1501aa48;hp=044e3307ec7aa47f2d203426fb7400751fb57777;hb=3d355800b5a5d2a536270b714f37a84d50b12168;hpb=02312592d27d628cc7e0d8e28cc40bf74a80de21 diff --git a/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java b/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java index 044e3307..f66f5249 100644 --- a/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java +++ b/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java @@ -226,12 +226,15 @@ public class Hbm2DdlMojo extends AbstractMojo /** * Target of execution: * * + * A databaseconnection is only needed for EXPORT and BOTH, but a + * Hibernate-Dialect must always be choosen. + * * @parameter property="hibernate.export.target" default-value="EXPORT" */ private String target; @@ -245,6 +248,8 @@ public class Hbm2DdlMojo extends AbstractMojo *
  • BOTH (DEFAULT!)
  • * * + * If NONE is choosen, no databaseconnection is needed. + * * @parameter property="hibernate.export.type" default-value="BOTH" */ private String type; @@ -582,12 +587,17 @@ public class Hbm2DdlMojo extends AbstractMojo MessageDigest digest = java.security.MessageDigest.getInstance("MD5"); for (String filename : hibernateMapping.split("[\\s,]+")) { - File file = null; - for (Resource resource : project.getResources()) + // First try the filename as absolute/relative path + File file = new File(filename); + if (!file.exists()) { - file = new File(resource.getDirectory() + File.separator + filename); - if (file.exists()) - break; + // If the file was not found, search for it in the resource-directories + for (Resource resource : project.getResources()) + { + file = new File(resource.getDirectory() + File.separator + filename); + if (file.exists()) + break; + } } if (file != null && file.exists()) { @@ -684,6 +694,7 @@ public class Hbm2DdlMojo extends AbstractMojo * hibernate does not use the context-classloader of the current * thread and, hence, would not be able to resolve the driver-class! */ + getLog().debug("Target: " + target + ", Type: " + type); switch (target) { case EXPORT: