Class Resolve.Files
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.maven.resolver.internal.ant.tasks.Resolve.ArtifactConsumer
org.apache.maven.resolver.internal.ant.tasks.Resolve.Files
- All Implemented Interfaces:
Cloneable
- Enclosing class:
Resolve
Artifact consumer that copies resolved artifacts to a local directory and optionally registers
them as an Ant
FileSet
or Resources
.
This is useful for collecting artifacts into a structured directory or exporting them as a resource collection for further processing in the build.
Usage Examples:
<resolve>
<dependencies>
<dependency groupId="org.example" artifactId="lib" version="1.0"/>
</dependencies>
<files refid="resolved.files" dir="libs"/>
</resolve>
- See Also:
-
Field Summary
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the classifier pattern used to match specific artifact attachments, such as sources or javadoc.void
process
(org.eclipse.aether.artifact.Artifact artifact, org.eclipse.aether.RepositorySystemSession session) Processes a resolved artifact by copying it to the destination directory or registering it as a resource in the Ant project.void
setAttachments
(String attachments) Specifies which type of attachment to resolve.void
Sets the output directory to which resolved artifacts will be copied.void
Sets the layout template used to determine the relative path of each artifact when copying files to the target directory.void
Sets the Ant reference ID under which the collected fileset or resources will be registered.void
validate()
Validates that either a destination directory or a reference ID is set.Methods inherited from class org.apache.maven.resolver.internal.ant.tasks.Resolve.ArtifactConsumer
accept, setClasspath, setScopes
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
-
Constructor Details
-
Files
public Files()Default constructor for Ant task instantiation.This constructor is used by Ant to create instances of the
Resolve.Files
consumer.
-
-
Method Details
-
setRefId
Sets the Ant reference ID under which the collected fileset or resources will be registered.- Parameters:
refId
- the reference ID to assign
-
getClassifier
Returns the classifier pattern used to match specific artifact attachments, such as sources or javadoc.- Overrides:
getClassifier
in classResolve.ArtifactConsumer
- Returns:
- the classifier pattern, or
null
if not set
-
setAttachments
Specifies which type of attachment to resolve. Valid values are:sources
javadoc
- Parameters:
attachments
- the attachment type- Throws:
org.apache.tools.ant.BuildException
- if an invalid type is provided
-
setDir
Sets the output directory to which resolved artifacts will be copied. If this is specified without an explicit layout, a default layout will be used.- Parameters:
dir
- the destination directory
-
setLayout
Sets the layout template used to determine the relative path of each artifact when copying files to the target directory.The layout is a string pattern using variables such as
${gid}
,${aid}
,${ver}
,${cls}
, and${ext}
to define where artifacts should be placed under the specifieddir
.This method is only meaningful if a
dir
is specified. If used without a directory, it will result in aBuildException
during validation.- Parameters:
layout
- the path layout pattern to apply for copied artifacts- See Also:
-
validate
public void validate()Validates that either a destination directory or a reference ID is set.- Overrides:
validate
in classResolve.ArtifactConsumer
- Throws:
org.apache.tools.ant.BuildException
- if the configuration is invalid
-
process
public void process(org.eclipse.aether.artifact.Artifact artifact, org.eclipse.aether.RepositorySystemSession session) Processes a resolved artifact by copying it to the destination directory or registering it as a resource in the Ant project.- Specified by:
process
in classResolve.ArtifactConsumer
- Parameters:
artifact
- the resolved artifactsession
- the current repository session
-