Class AbstractResolvingTask

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.maven.resolver.internal.ant.tasks.AbstractResolvingTask
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
Resolve

public abstract class AbstractResolvingTask extends org.apache.tools.ant.Task
Abstract base class for Ant tasks that perform dependency resolution using Maven Resolver (Aether).

This class encapsulates support for specifying and configuring dependencies, remote repositories, and the local repository used during resolution. It provides helper methods to collect dependencies and manage nested configuration elements.

This class is intended to be extended by concrete tasks that require dependency resolution, such as retrieving artifacts, resolving transitive dependencies, or analyzing dependency graphs.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Dependencies
    The dependency definitions to resolve.
    protected LocalRepository
    Optional custom local repository definition.
    The list of remote repositories to use for resolution.

    Fields inherited from class org.apache.tools.ant.Task

    target, taskName, taskType, wrapper

    Fields inherited from class org.apache.tools.ant.ProjectComponent

    description, location, project
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor for AbstractResolvingTask.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds a <dependencies> element to define the dependencies to be resolved.
    void
    Adds a single <remoteRepo> element to the list of remote repositories used for resolution.
    void
    Adds a <remoteRepos> element, representing a collection of remote repositories.
    protected org.eclipse.aether.collection.CollectResult
    Performs dependency collection using the configured Dependencies, LocalRepository, and RemoteRepositories.
    Creates a <localRepo> element to specify a custom local repository for resolution.
    void
    setDependenciesRef(org.apache.tools.ant.types.Reference ref)
    Sets a reference to an existing Dependencies instance using refid.
    void
    setRemoteReposRef(org.apache.tools.ant.types.Reference ref)
    Sets a reference to an existing RemoteRepositories instance using refid.

    Methods inherited from class org.apache.tools.ant.Task

    bindToOwner, execute, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType

    Methods inherited from class org.apache.tools.ant.ProjectComponent

    clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject

    Methods inherited from class java.lang.Object

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

    • dependencies

      protected Dependencies dependencies
      The dependency definitions to resolve. Configurable via a nested <dependencies> element or a reference using setDependenciesRef(Reference).
    • remoteRepositories

      protected RemoteRepositories remoteRepositories
      The list of remote repositories to use for resolution. Populated via one or more <remoteRepo> or <remoteRepos> nested elements.
    • localRepository

      protected LocalRepository localRepository
      Optional custom local repository definition. Created using the <localRepo> nested element.
  • Constructor Details

    • AbstractResolvingTask

      public AbstractResolvingTask()
      Default constructor for AbstractResolvingTask.
  • Method Details

    • addDependencies

      public void addDependencies(Dependencies dependencies)
      Adds a <dependencies> element to define the dependencies to be resolved.
      Parameters:
      dependencies - the Dependencies element to add
      Throws:
      org.apache.tools.ant.BuildException - if multiple <dependencies> elements are specified
    • setDependenciesRef

      public void setDependenciesRef(org.apache.tools.ant.types.Reference ref)
      Sets a reference to an existing Dependencies instance using refid.
      Parameters:
      ref - the reference to a Dependencies instance
    • createLocalRepo

      public LocalRepository createLocalRepo()
      Creates a <localRepo> element to specify a custom local repository for resolution.
      Returns:
      the created LocalRepository instance
      Throws:
      org.apache.tools.ant.BuildException - if multiple <localRepo> elements are specified
    • addRemoteRepo

      public void addRemoteRepo(RemoteRepository repository)
      Adds a single <remoteRepo> element to the list of remote repositories used for resolution.
      Parameters:
      repository - the remote repository to add
    • addRemoteRepos

      public void addRemoteRepos(RemoteRepositories repositories)
      Adds a <remoteRepos> element, representing a collection of remote repositories.
      Parameters:
      repositories - the remote repositories to add
    • setRemoteReposRef

      public void setRemoteReposRef(org.apache.tools.ant.types.Reference ref)
      Sets a reference to an existing RemoteRepositories instance using refid.
      Parameters:
      ref - the reference to a RemoteRepositories element
    • collectDependencies

      protected org.eclipse.aether.collection.CollectResult collectDependencies()
      Performs dependency collection using the configured Dependencies, LocalRepository, and RemoteRepositories.
      Returns:
      the result of the dependency collection
      Throws:
      org.apache.tools.ant.BuildException - if dependency collection fails