DependencyFilesets Task

This task will create fileset objects containing the Maven project dependencies. This can be used access specific dependency artifacts, or to operate on a set of dependency artifacts. Each artifact will be assigned a fileset ID in the form [prefix]groupId:artifactId:[classifier]:type. A dependency on a junit jar would be given a fileset ID of junit:junit:jar.

In addition, a single fileset containing all the project dependencies will be created using the default ID maven.project.dependencies

Task Parameters

AttributeDescriptionRequired
prefixString to prepend to all fileset IDsNo, defaults to empty string
projectDependenciesIdRefId for the fileset containing all project dependenciesNo, defaults to "maven.project.dependencies
scopesComma separated list of artifact scopes to includeNo, defaults to all artifacts
typesComma separated list of artifact types to includeNo, defaults to all artifacts

Example

This example shows how to access individual dependencies and the combined dependency fileset.

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.7</version>
        <executions>
          <execution>
            <id>copy-dependencies</id>
            <phase>package</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
        
                <dependencyfilesets prefix="mydeps."/>
                <mkdir dir="target/dependencies"/>
                <copy todir="target/dependencies">
                  <fileset refid="mydeps.junit:junit:jar"/>
                  <fileset refid="mydeps.org.apache.ant:ant:jar"/>
                </copy>
                
                <mkdir dir="target/dependencies2"/>
                <copy todir="target/dependencies2" flatten="true">
                  <fileset refid="mydeps.maven.project.dependencies"/>
                </copy>
        
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>