Class Resolve.Props
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.maven.resolver.internal.ant.tasks.Resolve.ArtifactConsumer
org.apache.maven.resolver.internal.ant.tasks.Resolve.Props
- All Implemented Interfaces:
Cloneable
- Enclosing class:
Resolve
Artifact consumer that maps resolved artifacts to Ant project properties.
Each resolved artifact is converted to a property key-value pair, where the key is based on the artifact coordinates and an optional prefix, and the value is the absolute path to the resolved artifact file.
This is useful for referencing artifacts in other tasks or scripts, especially when integration with tools that expect file paths as properties is needed.
Example output property format:
prefix.groupId:artifactId:extension[:classifier] = /path/to/artifact.jar
Example usage:
<resolve>
<dependencies>
<dependency groupId="org.example" artifactId="lib" version="1.0"/>
</dependencies>
<properties prefix="mydeps"/>
</resolve>
- See Also:
-
Field Summary
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
-
Constructor Summary
ConstructorsConstructorDescriptionProps()
This default constructor is used by Ant to create instances of theResolve.Props
consumer. -
Method Summary
Modifier and TypeMethodDescriptionReturns the classifier pattern used to match specific artifact attachments.void
process
(org.eclipse.aether.artifact.Artifact artifact, org.eclipse.aether.RepositorySystemSession session) Processes a resolved artifact by registering its absolute path as an Ant property.void
setAttachments
(String attachments) Specifies which type of attachment to resolve.void
Sets a prefix for the generated Ant property keys.Methods inherited from class org.apache.maven.resolver.internal.ant.tasks.Resolve.ArtifactConsumer
accept, setClasspath, setScopes, validate
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
-
Constructor Details
-
Props
public Props()This default constructor is used by Ant to create instances of theResolve.Props
consumer.
-
-
Method Details
-
setPrefix
Sets a prefix for the generated Ant property keys. For example, if prefix isresolved
, properties will be named like:resolved.groupId:artifactId:type[:classifier]
.- Parameters:
prefix
- the property key prefix
-
getClassifier
Returns the classifier pattern used to match specific artifact attachments.- Overrides:
getClassifier
in classResolve.ArtifactConsumer
- Returns:
- the classifier pattern, or
null
if not set
-
setAttachments
Specifies which type of attachment to resolve. Valid values are:sources
javadoc
- Parameters:
attachments
- the attachment type- Throws:
org.apache.tools.ant.BuildException
- if an invalid type is provided
-
process
public void process(org.eclipse.aether.artifact.Artifact artifact, org.eclipse.aether.RepositorySystemSession session) Processes a resolved artifact by registering its absolute path as an Ant property. The property name is derived from the artifact coordinates and the optional prefix.- Specified by:
process
in classResolve.ArtifactConsumer
- Parameters:
artifact
- the resolved artifactsession
- the current repository session
-