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
FieldsModifier and TypeFieldDescriptionprotected Dependencies
The dependency definitions to resolve.protected LocalRepository
Optional custom local repository definition.protected RemoteRepositories
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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDependencies
(Dependencies dependencies) Adds a<dependencies>
element to define the dependencies to be resolved.void
addRemoteRepo
(RemoteRepository repository) Adds a single<remoteRepo>
element to the list of remote repositories used for resolution.void
addRemoteRepos
(RemoteRepositories repositories) Adds a<remoteRepos>
element, representing a collection of remote repositories.protected org.eclipse.aether.collection.CollectResult
Performs dependency collection using the configuredDependencies
,LocalRepository
, andRemoteRepositories
.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 existingDependencies
instance usingrefid
.void
setRemoteReposRef
(org.apache.tools.ant.types.Reference ref) Sets a reference to an existingRemoteRepositories
instance usingrefid
.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
-
Field Details
-
dependencies
The dependency definitions to resolve. Configurable via a nested<dependencies>
element or a reference usingsetDependenciesRef(Reference)
. -
remoteRepositories
The list of remote repositories to use for resolution. Populated via one or more<remoteRepo>
or<remoteRepos>
nested elements. -
localRepository
Optional custom local repository definition. Created using the<localRepo>
nested element.
-
-
Constructor Details
-
AbstractResolvingTask
public AbstractResolvingTask()Default constructor forAbstractResolvingTask
.
-
-
Method Details
-
addDependencies
Adds a<dependencies>
element to define the dependencies to be resolved.- Parameters:
dependencies
- theDependencies
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 existingDependencies
instance usingrefid
.- Parameters:
ref
- the reference to aDependencies
instance
-
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
Adds a single<remoteRepo>
element to the list of remote repositories used for resolution.- Parameters:
repository
- the remote repository to add
-
addRemoteRepos
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 existingRemoteRepositories
instance usingrefid
.- Parameters:
ref
- the reference to aRemoteRepositories
element
-
collectDependencies
protected org.eclipse.aether.collection.CollectResult collectDependencies()Performs dependency collection using the configuredDependencies
,LocalRepository
, andRemoteRepositories
.- Returns:
- the result of the dependency collection
- Throws:
org.apache.tools.ant.BuildException
- if dependency collection fails
-