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

public static class Resolve.Path extends Resolve.ArtifactConsumer
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

    Constructors
    Constructor
    Description
    This default constructor is used by Ant to create instances of the Resolve.Path consumer.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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
    Validates that the required refid 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

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Path

      public Path()
      This default constructor is used by Ant to create instances of the Resolve.Path consumer.
  • Method Details

    • setRefId

      public void setRefId(String refId)
      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 required refid has been set.
      Overrides:
      validate in class Resolve.ArtifactConsumer
      Throws:
      org.apache.tools.ant.BuildException - if refid 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 class Resolve.ArtifactConsumer
      Parameters:
      artifact - the resolved artifact
      session - the active repository system session