This task is used to set an Ant FileSet variable with a list of artifacts that have been registered with the WeaverProjects task.


Attribute Description Required
fileset Id of the FileSet instantiated. Yes
type This specifies the type of artifact that the FileSet will contain. This value corresponds to the ‘type’ attribute for the ‘artifact’ nested element in WeaverProjects task. Yes
project This specifies the root project that will be used to obtain the artifacts. Starting at this root, the dependency graph will traversed and all artifacts of all project dependencies will be included in the FileSet. No. Defaults to all projects registered with WeaverProjects.
inclusive If set to ‘true’, then the FileSet created will include artifacts for the declared project. Otherwise, the FileSet will only contain artifacts for the dependency projects of the declared project. This attribute is ignored if the ‘project’ attribute is not declared. No. Defaults to ‘false’.


All of the examples below assume that the following WeaverProjects task instantiation has been declared:

<weaverProjects dir="c:/cvslocal/root">
  <project name="client" depends="common">
    <artifact type="build.file" file="projects/webapp/client/build.xml"/>
    <artifact type="jar" file="repository/client.jar"/>
  <project name="common">
    <artifact type="build.file" file="projects/webapp/common/build.xml"/>
    <artifact type="jar" file="repository/common.jar"/>
  <project name="server" depends="common">
    <artifact type="build.file" file="projects/webapp/server/build.xml"/>
    <artifact type="jar" file="repository/server.jar"/>

Example 1

<weaverFileSet fileset="server.build.files" project="server" type="build.file"/>
<for param="file">
  <fileset refid="server.build.files"/>
    <echo message="@{file}"/>

The call to ‘WeaverFileSet’ creates an Ant FileSet variable with the id ‘server.build.files’. A call to Ant-Contrib task ‘for’ is used to iterate over this FileSet, outputing the absolute path of ‘common/build.xml’ to the screen. The ‘server/build.xml’ file is not displayed, since the optional attribute ‘inclusive’ has not been set, and by default it is ‘false’.

Example 2

<weaverFileSet fileset="inclusive.server.jar.files" inclusive="true" project="server" type="jar"/>
<for param="file">
  <fileset refid="inclusive.server.jar.files"/>
    <echo message="@{file}"/>

This example is similar to the previous one, except we’re specifying ‘type’ equal to ‘jar’, rather than ‘build.files’. Also, we’ve set ‘inclusive’ to ‘true’. The result is that the absolute paths of ‘common.jar’ and ‘server.jar’ will be displayed.

Example 3

<weaverFileSet fileset="all.build.files" type="build.file"/>
<for param="file">
  <fileset refid="all.build.files"/>
    <echo message="@{file}"/>

In this example, the ‘project’ attribute is not declared. This causes the ‘WeaverFileSet’ to include all projects. The result is that the absolute paths of the build files for all three projects will be output.

It's only fair to share...
Share on Facebook
Tweet about this on Twitter
Share on LinkedIn

1 thought on “WeaverFileSet

  1. Pingback: WeaverFileList | i-Proving –

Leave a Reply