Class Artifact

java.lang.Object
org.glassfish.spec.Artifact

public final class Artifact extends Object
Represent the API JAR file as a Maven artifact.
  • Field Details

    • groupId

      private String groupId
      Artifact groupId.
    • artifactId

      private String artifactId
      Artifact artifactId.
    • version

      private org.apache.maven.artifact.versioning.ArtifactVersion version
      Artifact version.
    • buildNumber

      private String buildNumber
      Artifact build number.
    • BUILD_NUMBER_SEPARATORS

      private static final String[] BUILD_NUMBER_SEPARATORS
      Characters used to separate the build number within the version.
    • SNAPSHOT_QUALIFIER

      public static final String SNAPSHOT_QUALIFIER
      The Maven SNAPSHOT qualifier.
      See Also:
  • Constructor Details

    • Artifact

      public Artifact()
      Create a new Artifact instance.
    • Artifact

      public Artifact(String gId, String aId, String v)
      Create a new Artifact instance.
      Parameters:
      gId - the artifact groupId
      aId - the artifact artifactId
      v - the artifact version
  • Method Details

    • stripSnapshotQualifier

      public static String stripSnapshotQualifier(String qualifier)
      Strip the SNAPSHOT qualifier from a given qualifier.
      Parameters:
      qualifier - the qualifier to process
      Returns:
      a non SNAPSHOT qualifier
    • getBuildNumber

      private static String getBuildNumber(String qualifier)
      Parse a version qualifier and extract the build number.
      Parameters:
      qualifier - the qualifier to process
      Returns:
      the build number, or null if none found
    • getArtifactId

      public String getArtifactId()
      Get the artifactId for this artifact.
      Returns:
      the artifactId
    • getGroupId

      public String getGroupId()
      Get the groupId for this artifact.
      Returns:
      the groupId
    • getVersion

      public org.apache.maven.artifact.versioning.ArtifactVersion getVersion()
      Get the version for this artifact.
      Returns:
      the version
    • getAbsoluteVersion

      public String getAbsoluteVersion()
      Get the normalized release version for this artifact.
      Returns:
      the version
    • setArtifactId

      public void setArtifactId(String aId)
      Set the artifactId of this artifact.
      Parameters:
      aId - the artifactId value to use
    • setGroupId

      public void setGroupId(String gId)
      Set the groupId of this artifact.
      Parameters:
      gId - the artifactId value to use
    • setVersion

      public void setVersion(String v)
      Set the version of this artifact.
      Parameters:
      v - the artifactId value to use
    • getBuildNumber

      public String getBuildNumber()
      Get the build number of this artifact.
      Returns:
      the build number
    • getPomPropertiesFile

      private static ZipEntry getPomPropertiesFile(JarFile jar)
      Get the ZipEntry for pom.properties in the given JAR file.
      Parameters:
      jar - the jar file to process
      Returns:
      the ZipEntry if found, null otherwise
    • fromJar

      public static Artifact fromJar(JarFile jar) throws IOException
      Create an Artifact instance from a given JAR file.
      Parameters:
      jar - the jar file to process
      Returns:
      the create Artifact instance
      Throws:
      IOException - if an error occurs while reading JAR file entries
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object