Grokbase Groups Ant user May 2015
FAQ
Hello,

I've developed a few custom Ant tasks over time, but I need a little help
doing something specific to Ant's data types. I've created a task that
retrieves a set of files from a server, but the names aren't known in
advance, they're determine during execution of the task. I'd like to
create a fileset that has an ID and can be referred to later on by other
tasks and targets in the build.

This is how I assumed I'd get started:

FileSet fs = new FileSet();
fs.setId("someid");
fs.setProject(_project_);
fs.setDir(_dir_);
fs.createInclude().setName("entry/within/dir1/containing/file.abc");
fs.createInclude().setName("entry/within/dir2/containing/file.xyz");

I've some doubts about the "createInclude" logic... but I haven't got that
far yet. I'm stuck on the "setId()" part which just doesn't exist.

In a build script, I'd write:

<fileset id="someid" dir="somedir">
   <include name="relative/path/to/file" />
</fileset>

... then refer to it later with "refid".

How can I get this to work?

Thanks,
Christopher

Search Discussions

  • Dominique Devienne at May 16, 2015 at 2:51 pm

    On Sat, May 16, 2015 at 3:38 PM, Christopher BROWN wrote:

    I've some doubts about the "createInclude" logic... but I haven't got that
    far yet. I'm stuck on the "setId()" part which just doesn't exist.
    You probably need to call this Project.addReference API. Give it try, and
    see if that helps. --DD

    http://api.dpml.net/ant/1.7.0/org/apache/tools/ant/Project.html#addReference(java.lang.String,
    java.lang.Object)
  • Christopher BROWN at May 16, 2015 at 8:42 pm
    Hello Dominique,

    Thanks, I gave it a try, and it helped! Exactly what I was looking for...

    --
    Christopher


    On 16 May 2015 at 16:49, Dominique Devienne wrote:
    On Sat, May 16, 2015 at 3:38 PM, Christopher BROWN wrote:

    I've some doubts about the "createInclude" logic... but I haven't got that
    far yet. I'm stuck on the "setId()" part which just doesn't exist.
    You probably need to call this Project.addReference API. Give it try, and
    see if that helps. --DD


    http://api.dpml.net/ant/1.7.0/org/apache/tools/ant/Project.html#addReference(java.lang.String
    ,
    java.lang.Object)

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriesant
postedMay 16, '15 at 1:40p
activeMay 16, '15 at 8:42p
posts3
users2
websiteant.apache.org

People

Translate

site design / logo © 2018 Grokbase