ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Petar Tahchiev" <paranoia...@gmail.com>
Subject Re: Java task - output defaulting stdout
Date Tue, 14 Mar 2006 12:15:32 GMT
On 09/03/06, Frederic CHALONS <frederic.chalons@hsoftware.com> wrote:
> Hi,
>
> I would like to use a property to set the ouput of the java task.
> However when the user did not set that property I want to set it to a value
> corresponding to the console.
> (same behaviour when no "output" attribute is given).
>
> What value should I use?
> "" empty string does not seem to work.
>
> This way, if would like to avoid duplicating the my <java ... /> block.
>
> Thank you for your help,
>
> Frederic CHALONS
>
>

You could use the fact that properties in Ant are immutable, so you
use a property to store the filename, and if the user sets it with a
filename then you can't override its contents wih "console" for
instance. Otherwise you attempt to override its contents with
"console" and if you manage then the user has no set that property.
Later you use the outputproperty parameter of the java task and store
the output in a property. Finally you can check if the
filename-property equals console and if it does you simply <echo> its
contents!
This is a long way but you will definitly avoid duplicating the <java
... /> block.
Hope that helps!
--
Regards, Petar!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message