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.Pathconsumer. -
Method Summary
Modifier and TypeMethodDescriptionvoidprocess(org.eclipse.aether.artifact.Artifact artifact, org.eclipse.aether.RepositorySystemSession session) Adds the given artifact file to the configured Ant path.voidSets the reference ID for the Ant path to which resolved artifacts will be added.voidvalidate()Validates that the requiredrefidhas been set.Methods inherited from class org.apache.maven.resolver.internal.ant.tasks.Resolve.ArtifactConsumer
accept, getClassifier, setClasspath, setScopesMethods 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.Pathconsumer.
-
-
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 requiredrefidhas been set.- Overrides:
validatein classResolve.ArtifactConsumer- Throws:
org.apache.tools.ant.BuildException- ifrefidis 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:
processin classResolve.ArtifactConsumer- Parameters:
artifact- the resolved artifactsession- the active repository system session
-