On 2010-06-09, Jon Stevens wrote:

> On Wed, Jun 9, 2010 at 3:06 AM, Stefan Bodewig <bode...@apache.org> wrote:
>> Whereever you do

>>            <sfile name="${ant.jar}" scope="compile" />

>> you'd instead use

>>            <sfile scope="compile">
>>              <file file="${ant.jar}"/>
>>            </sfile>

> I see where you are going, but this won't work. I need to be able to
> define the attributes on the <file> element itself.

I think you've later seen that you don't since all the attributes of the
<file> are available via <sfile> as well.  Using Ant 1.8.0 you can even
do a sfile.as(FileProvider.class) to get access to the java.io.File
instance itself.

> Wrapping every <file> in a <sfile> is too much boilerplate typing.

Yep, absolutely.  That's why I suggested tagging a whole resource
collection later in my post.

>> and don't extend MatchingTask, this is so Ant 1.1 ;-)

> If you recall, I was the first person to use 'ant' outside of Sun, so
> my knowledge will forever be stuck in the past. =) Also, the
> documentation on the website is so out of date that it is hard to tell
> what I should use.

Is it?  Likely we should re-write parts of the tutorials to focus more
on resources and resource collection than on filesets and paths.

> What do you suggest over MatchingTask?

You don't need to extend any class at all since Ant can and will use
reflection for the execute method as well if you don't.

If you extend ProjectComponent you get the additional benefit of a
project instance and logging convenience methods.  The most common base
class would be Task, though.

> Ok, I think that definitely points me in the right direction. Thanks
> so much for your help. It is very much appreciated.

You're welcome

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

Reply via email to