ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craeg K Strong <cstr...@arielpartners.com>
Subject Re: property value from the result of executing a process?
Date Sun, 10 Jun 2001 05:54:46 GMT
Peter Vogel wrote:

>>Before I go and do this, I'm wondering if I'm just missing something.
>>
>>What I'm looking for is the ability to execute a process and store its
>>output
>>in a property, for example:
>>
>><property name="build" exec="cleartool describe -attr buildnum
>>${ant.file}"/>
>>
>>Or, if you prefer:
>>
>><property name="build">
>>    <exec executable="cleartool"> 
>>        <arg line="describe -attr buildnum ${ant.file}"/>
>>   </exec>
>></property>
>>
>>Or perhaps?
>>
>><target name="init">
>>    <exec executable="cleartool" property="build"> 
>>        <arg line="describe -attr buildnum ${ant.file}"/>
>>   </exec>
>></property>
>>    
>>
>>This seems like a pretty obvious bit of functionality to have, so I'm
>>surprised I
>>didn't see it already.  I'll implement if someone suggests the preferred
>>syntax 
>>for this.
>>
>>-Peter
>>
>
Sounds interesting.   This is just the kind of task that could be in a 
"taskdefs.org" library of contributed optional tasks, IMO.
Most of us would never need it, but for those few-- it could be quite 
valuable.  

However, as a quick and dirty solution:
Try executing the process, recording its output in a file, converting 
that into java.util.Properties format, and then
reading it in as a property file  (e.g.   <Property file="foo" /> )

HTH,

--Craeg Strong

-- 
Craeg K. Strong                               | www.arielpartners.com
Ariel Partners LLC		              | cstrong@arielpartners.com 
85 River Street, Ste. 3A                      | Fax:      (781) 647-9690
Waltham, MA 02453                             | Voice:    (781) 647-2425




Mime
View raw message