epugh 2004/07/23 03:35:14 Modified: hibernate/src/plugin-test/src/main hibernate.properties hibernate/src/main/org/apache/maven/hibernate/beans SchemaExportBean.java hibernate/src/plugin-test project.properties maven.xml hibernate plugin.jelly Added: hibernate/src/plugin-test/src/main hibernate.cfg.xml Log: MPHIBERNATE-10 maven-hibernate ignores the "config" attribute Revision Changes Path 1.2 +0 -2 maven-plugins/hibernate/src/plugin-test/src/main/hibernate.properties Index: hibernate.properties =================================================================== RCS file: /home/cvs/maven-plugins/hibernate/src/plugin-test/src/main/hibernate.properties,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- hibernate.properties 2 Jul 2004 06:16:56 -0000 1.1 +++ hibernate.properties 23 Jul 2004 10:35:13 -0000 1.2 @@ -2,6 +2,4 @@ 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:. 1.1 maven-plugins/hibernate/src/plugin-test/src/main/hibernate.cfg.xml Index: hibernate.cfg.xml =================================================================== <?xml version='1.0' encoding='utf-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd"> <hibernate-configuration> <!-- shared properties --> <session-factory> <property name="connection.driver_class">oracle.jdbc.OracleDriver</property> <property name="connection.url">jdbc:hsqldb:.</property> <property name="connection.username">sa</property> <property name="connection.password"></property> <property name="connection.pool_size">0</property> <property name="show_sql">false</property> <property name="dialect">org.hsqldb.jdbcDriver</property> <mapping resource="org/apache/maven/hibernate/Item.hbm.xml"/> </session-factory> </hibernate-configuration> 1.6 +16 -14 maven-plugins/hibernate/src/main/org/apache/maven/hibernate/beans/SchemaExportBean.java Index: SchemaExportBean.java =================================================================== RCS file: /home/cvs/maven-plugins/hibernate/src/main/org/apache/maven/hibernate/beans/SchemaExportBean.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- SchemaExportBean.java 2 Jul 2004 07:32:53 -0000 1.5 +++ SchemaExportBean.java 23 Jul 2004 10:35:13 -0000 1.6 @@ -202,24 +202,24 @@ 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 @@ { 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 (); 1.4 +1 -3 maven-plugins/hibernate/src/plugin-test/project.properties Index: project.properties =================================================================== RCS file: /home/cvs/maven-plugins/hibernate/src/plugin-test/project.properties,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- project.properties 5 Jul 2004 14:29:55 -0000 1.3 +++ project.properties 23 Jul 2004 10:35:13 -0000 1.4 @@ -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 1.4 +14 -2 maven-plugins/hibernate/src/plugin-test/maven.xml Index: maven.xml =================================================================== RCS file: /home/cvs/maven-plugins/hibernate/src/plugin-test/maven.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- maven.xml 5 Jul 2004 14:29:24 -0000 1.3 +++ maven.xml 23 Jul 2004 10:35:13 -0000 1.4 @@ -19,13 +19,15 @@ xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:assert="assert" + xmlns:maven="jelly:maven" xmlns:x="jelly:xml"> - <goal name="testPlugin" prereqs="test-hibernate-schema-export,test-hibernate-aggregate-mappings"> + <goal name="testPlugin" prereqs="test-hibernate-schema-export-properties,test-hibernate-aggregate-mappings"> <attainGoal name="clean"/> </goal> - <goal name="test-hibernate-schema-export"> + <goal name="test-hibernate-schema-export-properties"> + <j:set var="maven.hibernate.properties" value="${basedir}/src/main/hibernate.properties" /> <attainGoal name="jar"/> <attainGoal name="hibernate:schema-export"/> @@ -33,7 +35,17 @@ </goal> + <goal name="test-hibernate-schema-export-configuration"> + <j:set var="maven.hibernate.config" value="${basedir}/target/classes/hibernate.cfg.xml" /> + <attainGoal name="jar"/> + <attainGoal name="hibernate:schema-export"/> + + <assert:assertFileExists file="${maven.hibernate.output.file}"/> + + </goal> + <goal name="test-hibernate-aggregate-mappings"> + <j:set var="maven.hibernate.input.dir" value="${maven.build.dest},${basedir}/src/etc" /> <attainGoal name="jar"/> <attainGoal name="hibernate:aggregate-mappings"/> 1.7 +1 -0 maven-plugins/hibernate/plugin.jelly Index: plugin.jelly =================================================================== RCS file: /home/cvs/maven-plugins/hibernate/plugin.jelly,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- plugin.jelly 2 Jul 2004 07:32:53 -0000 1.6 +++ plugin.jelly 23 Jul 2004 10:35:13 -0000 1.7 @@ -44,6 +44,7 @@ <h:schema-export properties="${maven.hibernate.properties}" + config="${maven.hibernate.config}" quiet="${maven.hibernate.quiet}" text="${maven.hibernate.text}" drop="${maven.hibernate.drop}"
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]