Class AbstractDistTask
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.maven.resolver.internal.ant.tasks.AbstractDistTask
- All Implemented Interfaces:
Cloneable
public abstract class AbstractDistTask
extends org.apache.tools.ant.Task
Abstract base class for Ant tasks that perform distribution-related operations,
such as install or deploy. It handles the configuration and validation of POM and artifact inputs.
Subclasses are expected to use validate() to ensure input consistency
before proceeding with distribution logic.
This class ensures:
- Only one
<pom>element is specified - No duplicate artifacts with the same type/classifier are declared
- Artifact GAVs (groupId:artifactId:version) match their associated POM
-
Field Summary
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapperFields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddArtifact(Artifact artifact) Adds a singleArtifactto the task.voidaddArtifacts(Artifacts artifacts) Adds multipleArtifactsto the task.voidAdd the POM to use for artifact deployment or installation.protected ArtifactsReturns theArtifactscontainer, lazily instantiating if necessary.protected PomgetPom()Returns the current POM, falling back to the default POM if none has been explicitly set.voidsetArtifactsRef(org.apache.tools.ant.types.Reference ref) Adds a reference to an existingArtifactsinstance.voidsetPomRef(org.apache.tools.ant.types.Reference ref) Sets a reference to an existingPom.protected voidvalidate()Validates the configuration of the task before execution.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, setTaskTypeMethods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
-
Constructor Details
-
AbstractDistTask
public AbstractDistTask()Default constructor forAbstractDistTask.
-
-
Method Details
-
validate
protected void validate()Validates the configuration of the task before execution. Ensures there are no duplicate artifacts, that the POM is defined, and that each artifact's associated POM matches the main POM.- Throws:
org.apache.tools.ant.BuildException- if validation fails
-
getArtifacts
Returns theArtifactscontainer, lazily instantiating if necessary.- Returns:
- the artifact container
-
addArtifact
Adds a singleArtifactto the task.- Parameters:
artifact- the artifact to add
-
addArtifacts
Adds multipleArtifactsto the task.- Parameters:
artifacts- the artifacts to add
-
setArtifactsRef
public void setArtifactsRef(org.apache.tools.ant.types.Reference ref) Adds a reference to an existingArtifactsinstance.- Parameters:
ref- the reference to use
-
getPom
Returns the current POM, falling back to the default POM if none has been explicitly set.- Returns:
- the resolved
Pom
-
addPom
Add the POM to use for artifact deployment or installation.- Parameters:
pom- the POM to use- Throws:
org.apache.tools.ant.BuildException- if multiple<pom>elements are specified
-
setPomRef
public void setPomRef(org.apache.tools.ant.types.Reference ref) Sets a reference to an existingPom.- Parameters:
ref- the reference to set- Throws:
org.apache.tools.ant.BuildException- if multiple<pom>elements are specified
-