Package org.eclipse.aether.util.artifact
Class SubArtifact
java.lang.Object
org.eclipse.aether.artifact.AbstractArtifact
org.eclipse.aether.util.artifact.SubArtifact
- All Implemented Interfaces:
Artifact
An artifact whose identity is derived from another artifact. Note: Instances of this class are immutable and
the exposed mutators return new objects rather than changing the current instance.
-
Constructor Summary
ConstructorsConstructorDescriptionSubArtifact(Artifact mainArtifact, String classifier, String extension) Creates a new sub artifact.SubArtifact(Artifact mainArtifact, String classifier, String extension, File file) Creates a new sub artifact.SubArtifact(Artifact mainArtifact, String classifier, String extension, Path path) Creates a new sub artifact.SubArtifact(Artifact mainArtifact, String classifier, String extension, Map<String, String> properties) Creates a new sub artifact.SubArtifact(Artifact mainArtifact, String classifier, String extension, Map<String, String> properties, File file) Creates a new sub artifact.SubArtifact(Artifact mainArtifact, String classifier, String extension, Map<String, String> properties, Path path) Creates a new sub artifact. -
Method Summary
Modifier and TypeMethodDescriptionGets the artifact identifier of this artifact, for example "maven-model".Gets the base version of this artifact, for example "1.0-SNAPSHOT".Gets the classifier of this artifact, for example "sources".Gets the (file) extension of this artifact, for example "jar" or "tar.gz".getFile()Deprecated.Gets the group identifier of this artifact, for example "org.apache.maven".getPath()This method should (and in Resolver is) overridden, but is kept just to preserve backward compatibility if this class is extended somewhere.Gets the properties of this artifact.Gets the version of this artifact, for example "1.0-20100529-1213".booleanDetermines whether this artifact uses a snapshot version.Deprecated.Sets the file of the artifact.setProperties(Map<String, String> properties) Sets the properties for the artifact.Methods inherited from class org.eclipse.aether.artifact.AbstractArtifact
copyProperties, equals, getProperty, hashCode, setVersion, toString
-
Constructor Details
-
SubArtifact
Creates a new sub artifact. The classifier and extension specified for this artifact may use the asterisk character "*" to refer to the corresponding property of the main artifact. For instance, the classifier "*-sources" can be used to refer to the source attachment of an artifact. Likewise, the extension "*.asc" can be used to refer to the GPG signature of an artifact.- Parameters:
mainArtifact- the artifact from which to derive the identity, must not benullclassifier- the classifier for this artifact, may benullif noneextension- the extension for this artifact, may benullif none
-
SubArtifact
Creates a new sub artifact. The classifier and extension specified for this artifact may use the asterisk character "*" to refer to the corresponding property of the main artifact. For instance, the classifier "*-sources" can be used to refer to the source attachment of an artifact. Likewise, the extension "*.asc" can be used to refer to the GPG signature of an artifact.- Parameters:
mainArtifact- the artifact from which to derive the identity, must not benullclassifier- the classifier for this artifact, may benullif noneextension- the extension for this artifact, may benullif nonefile- the file for this artifact, may benullif unresolved
-
SubArtifact
Creates a new sub artifact. The classifier and extension specified for this artifact may use the asterisk character "*" to refer to the corresponding property of the main artifact. For instance, the classifier "*-sources" can be used to refer to the source attachment of an artifact. Likewise, the extension "*.asc" can be used to refer to the GPG signature of an artifact.- Parameters:
mainArtifact- the artifact from which to derive the identity, must not benullclassifier- the classifier for this artifact, may benullif noneextension- the extension for this artifact, may benullif nonepath- the file for this artifact, may benullif unresolved- Since:
- 2.0.0
-
SubArtifact
public SubArtifact(Artifact mainArtifact, String classifier, String extension, Map<String, String> properties) Creates a new sub artifact. The classifier and extension specified for this artifact may use the asterisk character "*" to refer to the corresponding property of the main artifact. For instance, the classifier "*-sources" can be used to refer to the source attachment of an artifact. Likewise, the extension "*.asc" can be used to refer to the GPG signature of an artifact.- Parameters:
mainArtifact- the artifact from which to derive the identity, must not benullclassifier- the classifier for this artifact, may benullif noneextension- the extension for this artifact, may benullif noneproperties- the properties of the artifact, may benull
-
SubArtifact
public SubArtifact(Artifact mainArtifact, String classifier, String extension, Map<String, String> properties, File file) Creates a new sub artifact. The classifier and extension specified for this artifact may use the asterisk character "*" to refer to the corresponding property of the main artifact. For instance, the classifier "*-sources" can be used to refer to the source attachment of an artifact. Likewise, the extension "*.asc" can be used to refer to the GPG signature of an artifact.- Parameters:
mainArtifact- the artifact from which to derive the identity, must not benullclassifier- the classifier for this artifact, may benullif noneextension- the extension for this artifact, may benullif noneproperties- the properties of the artifact, may benullfile- the file for this artifact, may benullif unresolved
-
SubArtifact
public SubArtifact(Artifact mainArtifact, String classifier, String extension, Map<String, String> properties, Path path) Creates a new sub artifact. The classifier and extension specified for this artifact may use the asterisk character "*" to refer to the corresponding property of the main artifact. For instance, the classifier "*-sources" can be used to refer to the source attachment of an artifact. Likewise, the extension "*.asc" can be used to refer to the GPG signature of an artifact.- Parameters:
mainArtifact- the artifact from which to derive the identity, must not benullclassifier- the classifier for this artifact, may benullif noneextension- the extension for this artifact, may benullif noneproperties- the properties of the artifact, may benullpath- the file for this artifact, may benullif unresolved- Since:
- 2.0.0
-
-
Method Details
-
getGroupId
Description copied from interface:ArtifactGets the group identifier of this artifact, for example "org.apache.maven".- Returns:
- The group identifier, never
null.
-
getArtifactId
Description copied from interface:ArtifactGets the artifact identifier of this artifact, for example "maven-model".- Returns:
- The artifact identifier, never
null.
-
getVersion
Description copied from interface:ArtifactGets 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. This may also return version ranges like "[1.0,2.0)". The exact syntax for (meta) versions and version ranges depends on the underlying provider (encapsulated inRepositorySystem).- Returns:
- The version, never
null.
-
getBaseVersion
Description copied from interface:ArtifactGets the base version of this artifact, for example "1.0-SNAPSHOT". In contrast to theArtifact.getVersion(), the base version will always refer to the unresolved meta version.- Specified by:
getBaseVersionin interfaceArtifact- Overrides:
getBaseVersionin classAbstractArtifact- Returns:
- The base version, never
null.
-
isSnapshot
Description copied from interface:ArtifactDetermines whether this artifact uses a snapshot version.- Specified by:
isSnapshotin interfaceArtifact- Overrides:
isSnapshotin classAbstractArtifact- Returns:
trueif the artifact is a snapshot,falseotherwise.
-
getClassifier
Description copied from interface:ArtifactGets the classifier of this artifact, for example "sources".- Returns:
- The classifier or an empty string if none, never
null.
-
getExtension
Description copied from interface:ArtifactGets the (file) extension of this artifact, for example "jar" or "tar.gz".- Returns:
- The file extension (without leading period), never
null.
-
getFile
Deprecated.Description copied from interface:ArtifactGets 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
nullif the artifact isn't resolved.
-
getPath
Description copied from class:AbstractArtifactThis method should (and in Resolver is) overridden, but is kept just to preserve backward compatibility if this class is extended somewhere.- Specified by:
getPathin interfaceArtifact- Overrides:
getPathin classAbstractArtifact- Returns:
- The file or
nullif the artifact isn't resolved.
-
setFile
Deprecated.Description copied from interface:ArtifactSets the file of the artifact.- Specified by:
setFilein interfaceArtifact- Overrides:
setFilein classAbstractArtifact- Parameters:
file- The file of the artifact, may benull- Returns:
- The new artifact, never
null.
-
setPath
Description copied from interface:ArtifactSets the file of the artifact.- Specified by:
setPathin interfaceArtifact- Overrides:
setPathin classAbstractArtifact- Parameters:
path- The file of the artifact, may benull- Returns:
- The new artifact, never
null.
-
getProperties
Description copied from interface:ArtifactGets 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:
-
setProperties
Description copied from interface:ArtifactSets the properties for the artifact. Note that these properties exist merely in memory and are not persisted when the artifact gets installed/deployed to a repository.- Specified by:
setPropertiesin interfaceArtifact- Overrides:
setPropertiesin classAbstractArtifact- Parameters:
properties- The properties for the artifact, may benull.- Returns:
- The new artifact, never
null. - See Also:
-