ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ultra Funkular <>
Subject AntStructure differences between api and buildfile usage
Date Wed, 19 Jun 2002 01:03:23 GMT
Stephen Bodewig (and anyone else),

The output file of the antstructure task varies hugely depending on how it 
was invoked.

If invoked through the api directly, then taskdefs must be added to the 
project instance for dtd information on those classes to be generated.
                 Project project = new Project();
                 Target target = new Target();
                 AntStructure task = new AntStructure();  // 
(AntStructure) project.createNewTask("antstructure");
  			project.addTaskDefinition( "javac", Class.forName( 
"") );
		catch(Exception e)
		File file = new File("ant2.dtd");
                 task.setOutput( file );
                 target.addTask( task );
                 final String TARGET_NAME = "CreateDTD";
                 project.addTarget(TARGET_NAME, target);

	catch(BuildException be)

In contrast, if a build file were to simply be:

<?xml version="1.0" encoding="UTF-8" ?>
<project default="dtd"
     <target name="dtd">
         <antstructure output="ant2.dtd"/>

Then every task existing in the ant.jar and optional.jar has their DTD 
information generated.  I love this!

How may I achieve the same result using the api?
the workaround is to output a build.xml file, then run ExecOn on it...

All help appreciated :)


T Master

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message