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
Attribute | Description | Required |
---|---|---|
prefix | String to prepend to all fileset IDs | No, defaults to empty string |
projectDependenciesId | RefId for the fileset containing all project dependencies | No, defaults to "maven.project.dependencies |
scopes | Comma separated list of artifact scopes to include | No, defaults to all artifacts |
types | Comma separated list of artifact types to include | No, defaults to all artifacts |
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.4</version> <executions> <execution> <id>copy-dependencies</id> <phase>package</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <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> </tasks> </configuration> </execution> </executions> </plugin>