ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: [Q:] Writing a simple Ant task?
Date Wed, 25 Sep 2002 18:46:48 GMT
I don't think so... I tried it with 1.4.1, and it didn't work. --DD

-----Original Message-----
From: Erik Hatcher [mailto:jakarta-ant@ehatchersolutions.com] 
Sent: Wednesday, September 25, 2002 1:46 PM
To: Ant Users List
Subject: Re: [Q:] Writing a simple Ant task?

Actually even in Ant 1.4.1 a task didn't need to extend from Task 
either, although it really is best to do so to have access to logging 
and the Project object.  All a task has to do is implement an execute() 
method :))

	Erik

Dominique Devienne wrote:
> This 'param class that extends DataType' is not necessary. Any class will
do
> as a sub-element, provided it can be created using an add / addConfigured
/
> create method in the task class. And with Ant 1.5, a task doesn't even
need
> to extend Task, although that doesn't hurt (and is sometimes necessary if
> one needs to access the Ant Project reference). Stefan will correct me if
> I'm wrong ;-) --DD
> 
> -----Original Message-----
> From: Ryan Cuprak [mailto:507107@corpmail.kodak.com] 
> Sent: Wednesday, September 25, 2002 12:42 PM
> To: Ant
> Subject: Re: [Q:] Writing a simple Ant task?
> 
> 
>  To accomplish this, you need to write a param class that extends
DataType,
> has a default constructor and setter/getter methods for the attributes. In
> the mytask (extends Task), you add a method "addParam" which takes your
> param class. 
>  Hopefully that answers your question!
> 
> -Ryan Cuprak
> 
> On 9/25/02 7:51 AM, "David M. Smith" <david.smith@home-free.demon.co.uk>
> wrote:
> 
> 
>>Hi,
>>
>>I wanted to write a task along the following lines
>>
>><mytask srcfile="" destfile="">
>>      <param find="Key1" replaceWith="Value1"/>
>>      <param find="Key2" replaceWith="Value2"/>
>>
>>      <param find="Keyn" replaceWith="Valuen"/>
>></mytask>
>>
>>In reading through the documentation trying to write this task I came
>>across copy and filterset which seem to do exactly what I want.
>>
>>However, I would still like to understand how I would write this task.
>>
>>Looking at the Ant source code, it seems generic enough to be able to
>>handle arbitary nested elements, but what methods must I put on my task
>>class to support this? I am thinking createParam(), setParam() and
>>getParam().
>>
>>Do I need to create a ant.types.Param class?
>>
>>Any advice that helps me write this task would be gratefully received.
>>
>>Regards,
>>David
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
> 
> 
> 


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

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


Mime
View raw message