Class DefaultDependency

java.lang.Object
org.apache.maven.internal.impl.DefaultDependency
All Implemented Interfaces:
Artifact, Dependency

public class DefaultDependency extends Object implements Dependency
  • Constructor Details

  • Method Details

    • key

      public String key()
      Description copied from interface: Artifact
      Returns a unique identifier for this artifact. The identifier is composed of groupId, artifactId, extension, classifier, and version.
      Specified by:
      key in interface Artifact
      Returns:
      a unique identifier for this artifact
      See Also:
    • getVersion

      public Version getVersion()
      Description copied from interface: Artifact
      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.
      Specified by:
      getVersion in interface Artifact
      Returns:
      the version of the artifact
      See Also:
    • getBaseVersion

      public Version getBaseVersion()
      Description copied from interface: Artifact
      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.
      Specified by:
      getBaseVersion in interface Artifact
      Returns:
      the version or meta-version of the artifact
    • isSnapshot

      public boolean isSnapshot()
      Description copied from interface: Artifact
      Determines whether this artifact uses a snapshot version.
      Specified by:
      isSnapshot in interface Artifact
      Returns:
      true if the artifact is a snapshot, false otherwise
      See Also:
    • isOptional

      public boolean isOptional()
      Description copied from interface: Dependency
      Returns whether the dependency is optional or mandatory. Contrarily to DependencyCoordinates, the obligation of a Dependency is always present. The value is computed during the dependencies collection phase.
      Specified by:
      isOptional in interface Dependency
      Returns:
      true if the dependency is optional, or false if mandatory
      See Also:
    • toCoordinates

      @Nonnull public DependencyCoordinates toCoordinates()
      Description copied from interface: Dependency
      Returns coordinates with the same identifiers as this dependency.
      Specified by:
      toCoordinates in interface Artifact
      Specified by:
      toCoordinates in interface Dependency
      Returns:
      coordinates with the same identifiers as this dependency
      See Also:
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getGroupId

      public String getGroupId()
      Returns the group identifier of the wrapped dependency. The default implementation delegates to the Eclipse Aether artifact.
      Returns:
      the group identifier of the wrapped dependency
    • getArtifactId

      public String getArtifactId()
      Returns the artifact identifier of the wrapped dependency. The default implementation delegates to the Eclipse Aether artifact.
      Returns:
      the artifact identifier of the wrapped dependency
    • getExtension

      public String getExtension()
      Returns the file extension of the wrapped dependency. The default implementation delegates to the Eclipse Aether artifact.
      Returns:
      the file extension of the wrapped dependency
    • getType

      public Type getType()
      Returns the type of the wrapped dependency. The default implementation infers the type from the properties associated to the Eclipse Aether artifact.
      Returns:
      the type of the wrapped dependency
    • getClassifier

      @Nonnull public String getClassifier()
      Returns the classifier ("jar", "test-jar", …) of the wrapped dependency. The default implementation first delegates to the Eclipse Aether artifact. If the latter does not provide a non-empty classifier, then the default value is determined by type.
      Returns:
      the classifier ("jar", "test-jar", …) of the wrapped dependency
    • getScope

      @Nonnull public DependencyScope getScope()
      Returns the scope (compile, test, …) of this dependency.
      Returns:
      the scope (compile, test, …) of this dependency
    • toString

      public String toString()
      Returns a string representation of this dependency. This is for debugging purposes only and may change in any future version.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this dependency