ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: Returning data from an Ant task?
Date Tue, 11 Jan 2005 09:12:08 GMT
The convention for tasks that need to set the value of a property (see 
the source code for the <property> task itself) is for it to take the 
name of a property as one of its attributes (like <property name="..." 
...>) and call setNewProperty(name, value).

So in your example, it'd look like this, instead of the <property> line 
you provided:

	<getversion property="MyVersion" fileName="..."/>

	Erik

On Jan 11, 2005, at 12:16 AM, Karl wrote:

> I'm writing a custom ant task that parses a text file and I'd like to 
> somehow pass the results back to the ant process. Is it possible to 
> return an "output parameter" string value to an ant process? Ideally 
> I'd like to do something like:
> <target name="getversion" description="Retrieves the version of the 
> product build out of the version file.">
>    <taskdef name="getversion" classname="GetVersion" 
> classpath="MyAntExtension.jar"/>
>    <property name="MyVersion" value={getversion 
> fileName="c:\work\AntExtensions\EXT_VERSION"} />
> </target>
> ?
> regards,
> Karl
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org


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


Mime
View raw message