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, wrapper
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addArtifact
(Artifact artifact) Adds a singleArtifact
to the task.void
addArtifacts
(Artifacts artifacts) Adds multipleArtifacts
to the task.void
Add the POM to use for artifact deployment or installation.protected Artifacts
Returns theArtifacts
container, lazily instantiating if necessary.protected Pom
getPom()
Returns the current POM, falling back to the default POM if none has been explicitly set.void
setArtifactsRef
(org.apache.tools.ant.types.Reference ref) Adds a reference to an existingArtifacts
instance.void
setPomRef
(org.apache.tools.ant.types.Reference ref) Sets a reference to an existingPom
.protected void
validate()
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, setTaskType
Methods 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 theArtifacts
container, lazily instantiating if necessary.- Returns:
- the artifact container
-
addArtifact
Adds a singleArtifact
to the task.- Parameters:
artifact
- the artifact to add
-
addArtifacts
Adds multipleArtifacts
to the task.- Parameters:
artifacts
- the artifacts to add
-
setArtifactsRef
public void setArtifactsRef(org.apache.tools.ant.types.Reference ref) Adds a reference to an existingArtifacts
instance.- 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
-