Class Artifacts
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.types.DataType
org.apache.maven.resolver.internal.ant.types.Artifacts
- All Implemented Interfaces:
Cloneable,ArtifactContainer
A container for one or more
Artifact elements in an Ant build script.
This Ant DataType is used to group multiple artifacts,
allowing them to be referenced collectively by tasks such as
Install or
Deploy.
Usage Example:
<repo:artifacts id="deployment.artifacts">
<repo:artifact file="target/my-lib.jar" type="jar" groupId="com.example" artifactId="my-lib" version="1.0.0"/>
<repo:artifact file="target/my-lib.pom" type="pom" groupId="com.example" artifactId="my-lib" version="1.0.0"/>
</repo:artifacts>
<repo:deploy artifactsRef="deployment.artifacts"/>
Attributes:
- id — Optional reference ID to reuse the container via
artifactsRef.
Nested Elements:
<artifact>— A single Maven artifact definition.<artifacts>— Another nestedArtifactselement, allowing composition.
This class also supports Ant references via refid, and prevents combining that
with nested artifact declarations.
- See Also:
-
Field Summary
Fields inherited from class org.apache.tools.ant.types.DataType
checked, refFields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddArtifact(Artifact artifact) Allow Ant to add a singleArtifactelement to this container.voidaddArtifacts(Artifacts artifacts) Allow Ant to add anotherArtifactscontainer as a nested element.Collects allArtifactobjects from this container and any nested containers.protected ArtifactsgetRef()Resolves this object if defined as a reference and verifies that it is aArtifactsinstance.voidsetRefid(org.apache.tools.ant.types.Reference ref) Sets a reference to anotherArtifactsinstance.voidvalidate(org.apache.tools.ant.Task task) Validates the nested artifact containers.Methods inherited from class org.apache.tools.ant.types.DataType
checkAttributesAllowed, checkChildrenAllowed, circularReference, clone, dieOnCircularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, tooManyAttributes, toStringMethods inherited from class org.apache.tools.ant.ProjectComponent
getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
-
Constructor Details
-
Artifacts
public Artifacts()Default constructor for theArtifactsdata type.
-
-
Method Details
-
getRef
Resolves this object if defined as a reference and verifies that it is aArtifactsinstance.- Returns:
- the referenced
Artifactsinstance - Throws:
org.apache.tools.ant.BuildException- if the reference is invalid
-
validate
public void validate(org.apache.tools.ant.Task task) Validates the nested artifact containers. If this is a reference, delegates to the referenced object.- Specified by:
validatein interfaceArtifactContainer- Parameters:
task- the Ant task using this data type- Throws:
org.apache.tools.ant.BuildException- if validation fails
-
setRefid
public void setRefid(org.apache.tools.ant.types.Reference ref) Sets a reference to anotherArtifactsinstance.- Overrides:
setRefidin classorg.apache.tools.ant.types.DataType- Parameters:
ref- the Ant reference- Throws:
org.apache.tools.ant.BuildException- if nested artifacts are already defined
-
addArtifact
Allow Ant to add a singleArtifactelement to this container.- Parameters:
artifact- the artifact to add
-
addArtifacts
Allow Ant to add anotherArtifactscontainer as a nested element.- Parameters:
artifacts- the nested container to add- Throws:
org.apache.tools.ant.BuildException- if a circular reference is detected
-
getArtifacts
Collects allArtifactobjects from this container and any nested containers.- Specified by:
getArtifactsin interfaceArtifactContainer- Returns:
- a list of all artifacts
-