From 1328dcb910f2504197bce94a6196b5c30fdfcf27 Mon Sep 17 00:00:00 2001 From: epugh Date: Fri, 23 Jul 2004 10:35:13 +0000 Subject: [PATCH] MPHIBERNATE-10 maven-hibernate ignores the "config" attribute git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115881 13f79535-47bb-0310-9956-ffa450edef68 --- hibernate/plugin.jelly | 1 + .../hibernate/beans/SchemaExportBean.java | 30 ++++++++++--------- hibernate/src/plugin-test/maven.xml | 16 ++++++++-- hibernate/src/plugin-test/project.properties | 4 +-- .../plugin-test/src/main/hibernate.cfg.xml | 25 ++++++++++++++++ .../plugin-test/src/main/hibernate.properties | 2 -- 6 files changed, 57 insertions(+), 21 deletions(-) create mode 100644 hibernate/src/plugin-test/src/main/hibernate.cfg.xml diff --git a/hibernate/plugin.jelly b/hibernate/plugin.jelly index 0870e4eb..320da34d 100644 --- a/hibernate/plugin.jelly +++ b/hibernate/plugin.jelly @@ -44,6 +44,7 @@ Michal Maczka - * @version $Id: SchemaExportBean.java,v 1.5 2004/07/02 07:32:53 epugh Exp $ + * @version $Id: SchemaExportBean.java,v 1.6 2004/07/23 10:35:13 epugh Exp $ */ public class SchemaExportBean extends CommonOperationsBean { @@ -202,24 +202,24 @@ public class SchemaExportBean extends CommonOperationsBean ClassLoader oldClassLoader = currentThread.getContextClassLoader(); try { - - File [] baseDirs = getBaseDirs (); - URL [] urls = new URL [baseDirs.length]; - for (int i = 0; i < urls.length; i++) { - urls [i] = baseDirs [i].toURL (); - System.out.println(urls [i]); - } + if (getConfig() == null){ + File [] baseDirs = getBaseDirs (); + URL [] urls = new URL [baseDirs.length]; + for (int i = 0; i < urls.length; i++) { + urls [i] = baseDirs [i].toURL (); + } - URLClassLoader newClassLoader = - new URLClassLoader(urls, getClass().getClassLoader()); - currentThread.setContextClassLoader(newClassLoader); + URLClassLoader newClassLoader = + new URLClassLoader(urls, getClass().getClassLoader()); + currentThread.setContextClassLoader(newClassLoader); + } Configuration cfg = getConfiguration(); SchemaExport schemaExport = getSchemaExport(cfg); if (isDrop()) { schemaExport.drop(!getQuiet(), !getText()); - } + } else { schemaExport.create(!getQuiet(), !getText()); @@ -238,8 +238,10 @@ public class SchemaExportBean extends CommonOperationsBean { Configuration cfg = new Configuration(); if (getConfig() != null) - { - cfg.configure(getConfig()); + { + File f = new File(getConfig()); + LOG.debug("File" + f.getAbsolutePath()); + cfg.configure(f); } String[] files = getFileNames (); diff --git a/hibernate/src/plugin-test/maven.xml b/hibernate/src/plugin-test/maven.xml index dc46c723..83a954dc 100644 --- a/hibernate/src/plugin-test/maven.xml +++ b/hibernate/src/plugin-test/maven.xml @@ -19,13 +19,15 @@ xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:assert="assert" + xmlns:maven="jelly:maven" xmlns:x="jelly:xml"> - + - + + @@ -33,7 +35,17 @@ + + + + + + + + + + diff --git a/hibernate/src/plugin-test/project.properties b/hibernate/src/plugin-test/project.properties index 72f13f38..9012d8f2 100644 --- a/hibernate/src/plugin-test/project.properties +++ b/hibernate/src/plugin-test/project.properties @@ -1,3 +1 @@ -maven.hibernate.properties=${basedir}/src/main/hibernate.properties -maven.hibernate.quiet=false -maven.hibernate.input.dir=${maven.build.dest},${basedir}/src/etc \ No newline at end of file +maven.hibernate.quiet=false \ No newline at end of file diff --git a/hibernate/src/plugin-test/src/main/hibernate.cfg.xml b/hibernate/src/plugin-test/src/main/hibernate.cfg.xml new file mode 100644 index 00000000..fd0a0a57 --- /dev/null +++ b/hibernate/src/plugin-test/src/main/hibernate.cfg.xml @@ -0,0 +1,25 @@ + + + + + + + + + + oracle.jdbc.OracleDriver + jdbc:hsqldb:. + sa + + 0 + false + org.hsqldb.jdbcDriver + + + + + + diff --git a/hibernate/src/plugin-test/src/main/hibernate.properties b/hibernate/src/plugin-test/src/main/hibernate.properties index 764288af..14756d55 100644 --- a/hibernate/src/plugin-test/src/main/hibernate.properties +++ b/hibernate/src/plugin-test/src/main/hibernate.properties @@ -2,6 +2,4 @@ hibernate.dialect net.sf.hibernate.dialect.HSQLDialect hibernate.connection.driver_class org.hsqldb.jdbcDriver hibernate.connection.username sa hibernate.connection.password -hibernate.connection.url jdbc:hsqldb:hsql://localhost -hibernate.connection.url jdbc:hsqldb:test hibernate.connection.url jdbc:hsqldb:. \ No newline at end of file