Package org.eclipse.aether.artifact
Class DefaultArtifact
java.lang.Object
org.eclipse.aether.artifact.AbstractArtifact
org.eclipse.aether.artifact.DefaultArtifact
- All Implemented Interfaces:
Artifact
A simple artifact. Note: Instances of this class are immutable and the exposed mutators return new objects
rather than changing the current instance.
-
Constructor Summary
ConstructorDescriptionDefaultArtifact
(String coords) Creates a new artifact with the specified coordinates.DefaultArtifact
(String groupId, String artifactId, String extension, String version) Creates a new artifact with the specified coordinates and no classifier.DefaultArtifact
(String groupId, String artifactId, String classifier, String extension, String version) Creates a new artifact with the specified coordinates.DefaultArtifact
(String groupId, String artifactId, String classifier, String extension, String version, Map<String, String> properties, File file) Creates a new artifact with the specified coordinates, properties and file.DefaultArtifact
(String groupId, String artifactId, String classifier, String extension, String version, Map<String, String> properties, ArtifactType type) Creates a new artifact with the specified coordinates and properties.DefaultArtifact
(String groupId, String artifactId, String classifier, String extension, String version, ArtifactType type) Creates a new artifact with the specified coordinates.DefaultArtifact
(String coords, Map<String, String> properties) Creates a new artifact with the specified coordinates and properties.DefaultArtifact
(String coords, Map<String, String> properties, ArtifactType type) Creates a new artifact with the specified coordinates, properties and type.DefaultArtifact
(String coords, ArtifactType type) Creates a new artifact with the specified coordinates and type. -
Method Summary
Modifier and TypeMethodDescriptionGets the artifact identifier of this artifact, for example "maven-model".Gets the classifier of this artifact, for example "sources".Gets the (file) extension of this artifact, for example "jar" or "tar.gz".getFile()
Gets the file of this artifact.Gets the group identifier of this artifact, for example "org.apache.maven".Gets the properties of this artifact.Gets the version of this artifact, for example "1.0-20100529-1213".Methods inherited from class org.eclipse.aether.artifact.AbstractArtifact
copyProperties, equals, getBaseVersion, getProperty, hashCode, isSnapshot, setFile, setProperties, setVersion, toString
-
Constructor Details
-
DefaultArtifact
Creates a new artifact with the specified coordinates. If not specified in the artifact coordinates, the artifact's extension defaults tojar
and classifier to an empty string.- Parameters:
coords
- The artifact coordinates in the format<groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>
, must not benull
.- Throws:
IllegalArgumentException
- If the artifact coordinates found incoords
do not match the expected format.
-
DefaultArtifact
Creates a new artifact with the specified coordinates and properties. If not specified in the artifact coordinates, the artifact's extension defaults tojar
and classifier to an empty string.- Parameters:
coords
- The artifact coordinates in the format<groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>
, must not benull
.properties
- The artifact properties, may benull
.- Throws:
IllegalArgumentException
- If the artifact coordinates found incoords
do not match the expected format.
-
DefaultArtifact
Creates a new artifact with the specified coordinates and type. If not specified in the artifact coordinates, the artifact's extension defaults to type extension (or "jar" if type isnull
) and classifier to type extension (or "" if type isnull
).- Parameters:
coords
- The artifact coordinates in the format<groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>
, must not benull
.type
- The artifact type, may benull
.- Throws:
IllegalArgumentException
- If the artifact coordinates found incoords
do not match the expected format.
-
DefaultArtifact
Creates a new artifact with the specified coordinates, properties and type. If not specified in the artifact coordinates, the artifact's extension defaults to type extension (or "jar" if type isnull
) and classifier to type extension (or "" if type isnull
).- Parameters:
coords
- The artifact coordinates in the format<groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>
, must not benull
.properties
- The artifact properties, may benull
.type
- The artifact type, may benull
.- Throws:
IllegalArgumentException
- If the artifact coordinates found incoords
do not match the expected format.
-
DefaultArtifact
Creates a new artifact with the specified coordinates and no classifier. Passingnull
for any of the coordinates is equivalent to specifying an empty string.- Parameters:
groupId
- The group identifier of the artifact, may benull
.artifactId
- The artifact identifier of the artifact, may benull
.extension
- The file extension of the artifact, may benull
.version
- The version of the artifact, may benull
.
-
DefaultArtifact
public DefaultArtifact(String groupId, String artifactId, String classifier, String extension, String version) Creates a new artifact with the specified coordinates. Passingnull
for any of the coordinates is equivalent to specifying an empty string.- Parameters:
groupId
- The group identifier of the artifact, may benull
.artifactId
- The artifact identifier of the artifact, may benull
.classifier
- The classifier of the artifact, may benull
.extension
- The file extension of the artifact, may benull
.version
- The version of the artifact, may benull
.
-
DefaultArtifact
public DefaultArtifact(String groupId, String artifactId, String classifier, String extension, String version, ArtifactType type) Creates a new artifact with the specified coordinates. Passingnull
for any of the coordinates is equivalent to specifying an empty string. The optional artifact type provided to this constructor will be used to determine the artifact's classifier and file extension if the corresponding arguments for this constructor arenull
.- Parameters:
groupId
- The group identifier of the artifact, may benull
.artifactId
- The artifact identifier of the artifact, may benull
.classifier
- The classifier of the artifact, may benull
.extension
- The file extension of the artifact, may benull
.version
- The version of the artifact, may benull
.type
- The artifact type from which to query classifier, file extension and properties, may benull
.
-
DefaultArtifact
public DefaultArtifact(String groupId, String artifactId, String classifier, String extension, String version, Map<String, String> properties, ArtifactType type) Creates a new artifact with the specified coordinates and properties. Passingnull
for any of the coordinates is equivalent to specifying an empty string. The optional artifact type provided to this constructor will be used to determine the artifact's classifier and file extension if the corresponding arguments for this constructor arenull
. If the artifact type specifies properties, those will get merged with the properties passed directly into the constructor, with the latter properties taking precedence.- Parameters:
groupId
- The group identifier of the artifact, may benull
.artifactId
- The artifact identifier of the artifact, may benull
.classifier
- The classifier of the artifact, may benull
.extension
- The file extension of the artifact, may benull
.version
- The version of the artifact, may benull
.properties
- The properties of the artifact, may benull
if none.type
- The artifact type from which to query classifier, file extension and properties, may benull
.
-
DefaultArtifact
public DefaultArtifact(String groupId, String artifactId, String classifier, String extension, String version, Map<String, String> properties, File file) Creates a new artifact with the specified coordinates, properties and file. Passingnull
for any of the coordinates is equivalent to specifying an empty string.- Parameters:
groupId
- The group identifier of the artifact, may benull
.artifactId
- The artifact identifier of the artifact, may benull
.classifier
- The classifier of the artifact, may benull
.extension
- The file extension of the artifact, may benull
.version
- The version of the artifact, may benull
.properties
- The properties of the artifact, may benull
if none.file
- The resolved file of the artifact, may benull
.
-
-
Method Details
-
getGroupId
Description copied from interface:Artifact
Gets the group identifier of this artifact, for example "org.apache.maven".- Returns:
- The group identifier, never
null
.
-
getArtifactId
Description copied from interface:Artifact
Gets the artifact identifier of this artifact, for example "maven-model".- Returns:
- The artifact identifier, never
null
.
-
getVersion
Description copied from interface:Artifact
Gets the version of this artifact, for example "1.0-20100529-1213". Note that in case of meta versions like "1.0-SNAPSHOT", the artifact's version depends on the state of the artifact. Artifacts that have been resolved or deployed will usually have the meta version expanded.- Returns:
- The version, never
null
.
-
getClassifier
Description copied from interface:Artifact
Gets the classifier of this artifact, for example "sources".- Returns:
- The classifier or an empty string if none, never
null
.
-
getExtension
Description copied from interface:Artifact
Gets the (file) extension of this artifact, for example "jar" or "tar.gz".- Returns:
- The file extension (without leading period), never
null
.
-
getFile
Description copied from interface:Artifact
Gets the file of this artifact. Note that only resolved artifacts have a file associated with them. In general, callers must not assume any relationship between an artifact's filename and its coordinates.- Returns:
- The file or
null
if the artifact isn't resolved.
-
getProperties
Description copied from interface:Artifact
Gets the properties of this artifact. Clients may use these properties to associate non-persistent values with an artifact that help later processing when the artifact gets passed around within the application.- Returns:
- The (read-only) properties, never
null
. - See Also:
-