ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <>
Subject Re: Returning a string as output from ANT task
Date Fri, 09 Nov 2007 10:54:45 GMT
Agarkar, M (Milind) wrote:
> Hi,
> I am trying to write a custom ant task to accept two parameters and
> return a string as the output. I have tried the following
> 1. First I did use the java task with 'outputproperty' and that works
> well, returns the output string fine, however, it also returns a lot of
> log statements from the java class, so, instead of returning a string,
> it actually returns a stringbuffer. This is not good because the output
> string is referred to in other targets

what else does <java> output? It shouldnt return anything else except 
that which your program prints

> 2. I tried writing in output file and that works perfect. Hoeever this
> is not the preferable solution for me.

if you write to a properties file, you can read it in later with 
<property file>

> 3. I tried writing a custom ant task extending java task and tried to
> get the outputproperty, but it does not seem to work either. It does not
> return the outputproperty as the java task does.

if the code is all running in-process, just call 
getProject().setNewProperty() with the property+value you want to set.

Steve Loughran        
Author: Ant in Action 

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

View raw message