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
Direct Known Subclasses:
Deploy, Install

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
    Constructor
    Description
    Default constructor for AbstractDistTask.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds a single Artifact to the task.
    void
    Adds multiple Artifacts to the task.
    void
    addPom(Pom pom)
    Add the POM to use for artifact deployment or installation.
    protected Artifacts
    Returns the Artifacts container, lazily instantiating if necessary.
    protected Pom
    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 existing Artifacts instance.
    void
    setPomRef(org.apache.tools.ant.types.Reference ref)
    Sets a reference to an existing Pom.
    protected void
    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

    Methods inherited from class java.lang.Object

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

    • AbstractDistTask

      public AbstractDistTask()
      Default constructor for AbstractDistTask.
  • 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

      protected Artifacts getArtifacts()
      Returns the Artifacts container, lazily instantiating if necessary.
      Returns:
      the artifact container
    • addArtifact

      public void addArtifact(Artifact artifact)
      Adds a single Artifact to the task.
      Parameters:
      artifact - the artifact to add
    • addArtifacts

      public void addArtifacts(Artifacts artifacts)
      Adds multiple Artifacts 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 existing Artifacts instance.
      Parameters:
      ref - the reference to use
    • getPom

      protected Pom getPom()
      Returns the current POM, falling back to the default POM if none has been explicitly set.
      Returns:
      the resolved Pom
    • addPom

      public void addPom(Pom pom)
      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 existing Pom.
      Parameters:
      ref - the reference to set
      Throws:
      org.apache.tools.ant.BuildException - if multiple <pom> elements are specified