ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@bost.de>
Subject Re: Capturing ANT Output
Date Tue, 07 Nov 2000 08:29:44 GMT
>>>>> "MDS" == Michael D Simpson <msimpson@itglink.com> writes:

 MDS> I want a servlet to run ANT on a form submission and display its
 MDS> output in HTML. I plan to just use the object
 MDS> org.apache.tools.ant.Main directly instead of exec'ing a new
 MDS> process.

You could even bypass Main and directly work with a Project object I
think.

 MDS> How can I capture ANT's output to get it printed to my servlet's
 MDS> HMTL output stream?

Ant's output is not really generated by the tasks, targets or whatever
but by the BuildLogger associated to it. There shouldn't be any
System.out.println-s left, everything happens in a event driven
logging system.

What you probably want to do is to attach a BuildListener to your
Project instance and build your output based on the generated
events. A BuildLogger is just a special kind of BuildListener that is
allowed to write to System.out (you don't need that).

As your target format is HTML, maybe XmlLogger is a starting point (or
maybe not, I'm not sure). There is a XSLT stylesheet in src/etc that
transforms the output of XmlLogger to (X)HTML.

Stefan

Mime
View raw message