ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Agarkar, M (Milind)" <>
Subject RE: Returning a string as output from ANT task
Date Fri, 09 Nov 2007 15:44:51 GMT
Thanks. That worked fine. 

-----Original Message-----
From: Steve Loughran [] 
Sent: 09 November 2007 10:55
To: Ant Users List
Subject: Re: Returning a string as output from ANT task

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:


This email (including any attachments to it) is confidential, legally privileged, subject
to copyright and is sent for the personal attention of the intended recipient only. If you
have received this email in error, please advise us immediately and delete it. You are notified
that disclosing, copying, distributing or taking any action in reliance on the contents of
this information is strictly prohibited. Although we have taken reasonable precautions to
ensure no viruses are present in this email, we cannot accept responsibility for any loss
or damage arising from the viruses in this email or attachments. We exclude any liability
for the content of this email, or for the consequences of any actions taken on the basis of
the information provided in this email or its attachments, unless that information is subsequently
confirmed in writing. If this email contains an offer, that should be considered as an invitation
to treat.

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

View raw message