ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Murdoch" <adammurdoch...@yahoo.com>
Subject RE: Exporting a Project Instance
Date Sat, 23 Mar 2002 11:27:53 GMT


> -----Original Message-----
> From: jbjk@mac.com [mailto:jbjk@mac.com]
> Sent: Saturday, 23 March 2002 9:06 PM
> To: Ant Developers List
> Subject: Re: Exporting a Project Instance
>

> I have a code generator which produces a different number of Java classes
> based upon the input).  The names of these classes are also dependent on
> the input.  To make it that bit easier to work with the generated code I
> also
> generate a build.xml file.  I currently do this by hand crafting the XML
> using
> StringBuffer.append(...).  For example if I add a copy task to the
> project, I
> simply do something like:
>
> buff.append("<copy file=\"").append(sourceFileName).append("\"");
> buff.append(" tofile=\"").append(destFilename).append("\"");
> buff.append(" />\n");
>
> This is fine for the limited tasks I currently use.  I was thinking that
> in the
> future I may require to add other tasks and as such the amount of code I
> need
> to write increases.  The responses on this thread have been helpful and I
> now realise that my simplistic approach will not work.  The object model
> approach that Adam discussed seems to be the best way to achieve what
> I require.
>

Unfortunately, you might have a bit of a wait for the project model to
actually happen.  Have you thought about using something like JDom to build
the XML, rather than hand crafting it?  Or, maybe using something like
Castor or JAXB to generate a bunch of proxies for the tasks, that can turn
themselves into XML.


Adam


--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message