Class Resolve.Path
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.Path
- All Implemented Interfaces:
Cloneable
- Enclosing class:
Resolve
Artifact consumer that adds resolved artifacts to an Ant
Path
.
This is useful for dynamically constructing classpaths from resolved Maven dependencies.
Each resolved artifact is wrapped in a FileResource
and added to a path registered under the specified Ant reference ID.
Usage Example:
<resolve>
<dependencies>
<dependency groupId="org.example" artifactId="lib" version="1.0"/>
</dependencies>
<path refid="my.classpath"/>
</resolve>
- See Also:
-
Field Summary
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
-
Constructor Summary
ConstructorsConstructorDescriptionPath()
This default constructor is used by Ant to create instances of theResolve.Path
consumer. -
Method Summary
Modifier and TypeMethodDescriptionvoid
process
(org.eclipse.aether.artifact.Artifact artifact, org.eclipse.aether.RepositorySystemSession session) Adds the given artifact file to the configured Ant path.void
Sets the reference ID for the Ant path to which resolved artifacts will be added.void
validate()
Validates that the requiredrefid
has been set.Methods inherited from class org.apache.maven.resolver.internal.ant.tasks.Resolve.ArtifactConsumer
accept, getClassifier, setClasspath, setScopes
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
-
Constructor Details
-
Path
public Path()This default constructor is used by Ant to create instances of theResolve.Path
consumer.
-
-
Method Details
-
setRefId
Sets the reference ID for the Ant path to which resolved artifacts will be added.- Parameters:
refId
- the Ant reference ID
-
validate
public void validate()Validates that the requiredrefid
has been set.- Overrides:
validate
in classResolve.ArtifactConsumer
- Throws:
org.apache.tools.ant.BuildException
- ifrefid
is not provided
-
process
public void process(org.eclipse.aether.artifact.Artifact artifact, org.eclipse.aether.RepositorySystemSession session) Adds the given artifact file to the configured Ant path.- Specified by:
process
in classResolve.ArtifactConsumer
- Parameters:
artifact
- the resolved artifactsession
- the active repository system session
-