You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Donald Strong <ds...@agentissoftware.com> on 2004/10/14 09:22:09 UTC

MatchingTask (derivative) doesn't support nested fileset.

I am writing a task that will include a fileset.
I extended MatchingTask thinking I would get FileSet
suport for free but Ant is barfing.

I have also had trouble finding any examples of what
to do to process the FileSet. Am I doing the right thing
below?

Any help appreciated.

Regards
Donald.

------------- Output ---------------------------------
$ ant test

... snip

BUILD FAILED
C:\dev\sandbox\buildlog\build.xml:107: The <buildlog> type doesn't 
support the nested "fileset" element.

Total time: 1 second

----------- build.xml -----------------

  <target name="declare" depends="compile">
    <taskdef name="buildlog"
        classname="${buildlog.task}" >
      <classpath refid="runtime.classpath.id"/>
    </taskdef>
  </target>
...
    <buildlog datasource="${dsn}"
              type="junit"
              appserver="${appserver}"
              dbms="${dbms}"
              opsys="${opsys}"
              testtype="${testtype}"
              release="${release}"
              version="${version}"
              timestamp="${timestamp}"
              testgroup="${testgroup}"
              >
      <fileset dir="${data.dir}">
        <include name="${testfile}.xml" />
      </fileset>
    </buildlog>

------------ Java file --------
public class BuildLogTask extends MatchingTask {

...

    protected void processDataFiles() throws BuildException
    {
        DirectoryScanner ds = fileset.getDirectoryScanner(getProject());
        String [] files = ds.getIncludedFiles();

        if (files.length == 0)
            throw new BuildException("<buildlog> task fileset is empty");

        for (int i=0; i<files.length; i++) {

            setDatafile(files[i]);

            // Load the DataFile
            if (!loader.LoadDataFile())
                throw new BuildException("Unable to load data file: " +
                                         files[i]);
        }
    }
--------------------------------

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


Re: MatchingTask (derivative) doesn't support nested fileset.

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 14 Oct 2004, Donald Strong <ds...@agentissoftware.com>
wrote:

> I am writing a task that will include a fileset.
> I extended MatchingTask thinking I would get FileSet
> suport for free but Ant is barfing.

MatchingTask predates FileSet and really is not the recommended way to
write new tasks.  MatchingTask gives you a single (implicit) fileset
for free.

> I have also had trouble finding any examples of what
> to do to process the FileSet.

Hmm, take any of the simpler Ant tasks.  <concat>?

> Am I doing the right thing below?

Basically yes.

Note that the file names returned by getIncludedFiles are relative to
the fileset's basedir.  You may need to tell setDatafile about the
basedir as well.

Stefan

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


Re: MatchingTask (derivative) doesn't support nested fileset.

Posted by Ivan Ivanov <ra...@yahoo.com>.
Hi Donald,
AFAIK, Matching task supports <include name="...">
nested tag, not <fileset>, so you should use your
<buildlog> task like this:
>     <buildlog datasource="${dsn}"
>               type="junit"
>               appserver="${appserver}"
>               dbms="${dbms}"
>               opsys="${opsys}"
>               testtype="${testtype}"
>               release="${release}"
>               version="${version}"
>               timestamp="${timestamp}"
>               testgroup="${testgroup}">             
 
>         <include name="${testfile}.xml" />
>     </buildlog>

HTH Ivan

--- Donald Strong <ds...@agentissoftware.com> wrote:

> I am writing a task that will include a fileset.
> I extended MatchingTask thinking I would get FileSet
> suport for free but Ant is barfing.
> 
> I have also had trouble finding any examples of what
> to do to process the FileSet. Am I doing the right
> thing
> below?
> 
> Any help appreciated.
> 
> Regards
> Donald.
> 
> ------------- Output
> ---------------------------------
> $ ant test
> 
> ... snip
> 
> BUILD FAILED
> C:\dev\sandbox\buildlog\build.xml:107: The
> <buildlog> type doesn't 
> support the nested "fileset" element.
> 
> Total time: 1 second



		
__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo 

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