Writing an Ant script

You can start JaxMe from an Ant script by integrating the taskdef called jaxme.

The first section of the following code defines the JaxMe code generator task  The second section is an example of how the taskdef jaxme is used.

     <taskdef name="jaxme"
         classname="de.ispsoft.jaxme.generator.ant.JaxMeGeneratorTask">
       <classpath/>
         <pathelement location="jaxme.jar"/>
         <pathelement location="log4j.jar"/6gt;
       </classpath/>
     </taskdef>
    
     <jaxme inputFile="myschema.xsd"
         destDir="build/src">
       <sourceWriter className="de.ispsoft.jaxme.generator.JavaSourceWriter"/>
     </jaxme>
The jaxme task supports the following attributes:
 
 
Name Required Description
inputFile or inputURL Either inputFile or inputURL Name of the JaxMe schema file (or the URL of the JaxMe schema, if it's not a local file)
destDir No Directory where to generate sources; subdirectories will be created to match a package structure
destFile No If this option is present, then the modification time of the JaxMe schema file will be compared with the modification time of the given destination file. If the latter is younger, then the JaxMe task does nothing. 
logLevel No Sets the logging level. Valid values are debug, info, warn (default) or error.
force No If the task is generating a file that already exists and is different, then by default the modification times of schema file and and destination file are compared. If the latter is younger, an exception is thrown. The force option modifies this behavior to overwrite the existing file.

The jaxme task supports the following nested elements:
 
Name Attributes Description
schemaReader className Sets the schemaReader class; defaults to de.ispsoft.jaxme.generator.XsdSchemaReader .
sourceWriter className Adds a SourceWriter; for example de.ispsoft.jaxme.generator.JavaSourceWriter .
option name, target, value Adds an option with the given name and value. The target is an optional class or interface name. If the target is missing, then the option applies to all objects.

For details see JaxMeGeneratorTask  and Reference.

NEXT     PREVIOUS  TABLE OF CONTENTS