Interface Artifact

All Known Subinterfaces:
Dependency, DownloadedArtifact, DownloadedDependency, ProducedArtifact
All Known Implementing Classes:
DefaultArtifact, DefaultDependency, DefaultDownloadedArtifact, DefaultProducedArtifact

@Experimental @Immutable public interface Artifact
A Maven artifact is a file, typically a JAR, that is produced and used by Maven projects. It is identified by a unique combination of a group ID, artifact ID, version, classifier, and extension, and it is stored in a repository for dependency management and build purposes.

Each Artifact instance is basically an exact pointer to a file in a Maven repository. Artifact instances are created when resolving ArtifactCoordinates instances. Resolving is the process that selects a particular version and downloads the artifact in the local repository. This operation returns a DownloadedArtifact.

Since:
4.0.0
  • Method Details

    • key

      @Nonnull default String key()
      Returns a unique identifier for this artifact. The identifier is composed of groupId, artifactId, extension, classifier, and version.
      Returns:
      a unique identifier for this artifact
      See Also:
    • getGroupId

      @Nonnull String getGroupId()
      Returns the group identifier of the artifact.
      Returns:
      the group identifier of the artifact
      See Also:
    • getArtifactId

      @Nonnull String getArtifactId()
      Returns the identifier of the artifact.
      Returns:
      the identifier of the artifact
      See Also:
    • getVersion

      @Nonnull Version getVersion()
      Returns the version of the artifact. Contrarily to ArtifactCoordinates, each Artifact is associated to a specific version instead of a range of versions. If the base version contains a meta-version such as SNAPSHOT, those keywords are replaced by, for example, the actual timestamp.
      Returns:
      the version of the artifact
      See Also:
    • getBaseVersion

      @Nonnull Version getBaseVersion()
      Returns the version or meta-version of the artifact. A meta-version is a version suffixed with the SNAPSHOT keyword. Meta-versions are represented in a base version by their symbols (e.g., SNAPSHOT), while they are replaced by, for example, the actual timestamp in the version.
      Returns:
      the version or meta-version of the artifact
    • getClassifier

      @Nonnull String getClassifier()
      Returns the classifier of the artifact.
      Returns:
      the classifier or an empty string if none, never null
      See Also:
    • getExtension

      @Nonnull String getExtension()
      Returns the file extension of the artifact. The dot separator is not included in the returned string.
      Returns:
      the file extension or an empty string if none, never null
      See Also:
    • isSnapshot

      boolean isSnapshot()
      Determines whether this artifact uses a snapshot version.
      Returns:
      true if the artifact is a snapshot, false otherwise
      See Also:
    • toCoordinates

      @Nonnull ArtifactCoordinates toCoordinates()
      Returns coordinates with the same identifiers as this artifact. This is a shortcut for session.createArtifactCoordinates(artifact).
      Returns:
      coordinates with the same identifiers as this artifact
      See Also: