Maybe the second tutorial (not finished yet) would help you. Tutorial on [1] and sources on [2]. Especially the part about filesets [3].
Jan [1] http://cvs.apache.org/viewcvs.cgi/*checkout*/ant/docs/manual/tutorial-tasks- filesets-properties.html?content-type=text%2Fplain [2] http://cvs.apache.org/viewcvs.cgi/ant/docs/manual/tutorial-tasks-filesets-pr operties.zip?only_with_tag=HEAD [3] http://cvs.apache.org/viewcvs.cgi/*checkout*/ant/docs/manual/tutorial-tasks- filesets-properties.html?content-type=text%2Fplain#filesets > -----Original Message----- > From: Mark McKay [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 21, 2004 10:43 AM > To: Ant Developers List > Subject: Re: Help creating a MatchingTask > > > Conor MacNeill wrote: > > >Mark, > > > >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 > > > ><task> > > <fileset .../> > ></task> > > > >It's a cleaner approach overall. > > > >Conor > > > > > > 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. > BUILD FAILED > > 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" > classname="com.kitfox.anttask.MyAntTask" > classpath="${ant.project.name}.jar"/> > <walkTree> > <fileset> > <includes name="**/*.class"/>> > </fileset> > </walkTree> > </target> > > > 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 = > sourceFiles.getDirectoryScanner(getProject()); > > scanner.scan(); > > String[] files = scanner.getIncludedFiles(); > for (int i = 0; i < files.length; i++) { > //System.out.println(files[i]); > log(files[i]); > } > > } > > } > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] >