ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark McKay <>
Subject Re: Help creating a MatchingTask
Date Wed, 21 Jan 2004 09:42:56 GMT
Conor MacNeill wrote:

>Peter and Jan look to have figured out your compile issue. I would recommend, 
>however, that you reconsider using MatchingTask. It was the way early Ant 
>tasks were implements but it is not ideal. A better approach would be to use 
>an addFileset(FileSet fs) method and process that fileset (or multiple 
>filesets) in your execute method.
>Your task then has an explicit fileset
>  <fileset .../>
>It's a cleaner approach overall.

Thanks for all the help offered so far.  I've modified my code and 
getting better results, but am still error prone. 

I can build my ant task now; however, when I try to use it I get:

    build.xml [18] The <fileset> data type doesn't support the nested 
"includes" element.

I'm assuming this means that 'fileset' is seen as an ordinary nested 
element, and not the special FileSet facility provided by Ant.

I've included my task and code.  Any further help would be great!

Mark McKay


    <target name="use" description="Use the Task" depends="jar">
        <taskdef name="walkTree"
                <includes name="**/*.class"/>>

public class MyAntTask extends MatchingTask {
    FileSet sourceFiles;
    /** Creates a new instance of MyAntTask */
    public MyAntTask() {

    public void addFileset(FileSet fs)
        sourceFiles = fs;

    public void execute() throws BuildException
        log("Walking tree");
        DirectoryScanner scanner = 
        String[] files = scanner.getIncludedFiles();
        for (int i = 0; i < files.length; i++) {

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message