Greetings,

There appears to be a bug in org.apache.openjpa.jdbc.ant.SchemaToolTask which prevents ant users from using the action "reflect".

My ant target is as follows:

<target name="genschema">
<taskdef name="schematool" classname="org.apache.openjpa.jdbc.ant.SchemaToolTask" classpathref="cp"/>
    <schematool action="reflect" file="schema.xml">
        <classpath refid="cp"/>
        <config propertiesFile="kodo.properties"/>
    </schematool>
</target>

The problem is that SchemaToolTask requires a fileset, but schematool itself requires that there NOT be a fileset, when performing action "reflect". This makes it impossible to execute the reflect action from the ant task.

The offending code in SchemaToolTask is the assertFiles() call, marked below:
---
protected void executeOn(String[] files)
    throws Exception {
    assertFiles(files);  // OFFENDING CODE

    ClassLoader loader = getClassLoader();
    flags.writer = Files.getWriter(file, loader);
    if (!SchemaTool.run((JDBCConfiguration) getConfiguration(), files,
        flags, loader))
        throw new BuildException(_loc.get("bad-conf", "SchemaToolTask")
            .getMessage());
}
---
Note that when SchemaTool.run(...) is called for action "reflect", it checks the passed in files[] array, and if it is non-empty, then returns an error condition.

Hopefully this can be fixed soon, thanks.

Drew

Reply via email to