Class ArtifactCoordinate


  • public class ArtifactCoordinate
    extends Object
    Represents an artifact coordinate but with optional version (the DefaultArtifact implementation doesn't support optional versions which is why we needed this class).
    Since:
    11.2RC1
    Version:
    $Id: 4651562f05846deb3484e4d32976fd1b3cc49d6d $
    • Constructor Detail

      • ArtifactCoordinate

        public ArtifactCoordinate​(String groupId,
                                  String artifactId,
                                  String type,
                                  String version)
        Parameters:
        groupId - the group id
        artifactId - the artifact id
        type - the type (e.g. "jar"), can be null
        version - the version, can be null
    • Method Detail

      • getGroupId

        public String getGroupId()
        Returns:
        the group id
      • getArtifactId

        public String getArtifactId()
        Returns:
        the artifact id
      • getVersion

        public String getVersion()
        Returns:
        the version, which can be null
      • getType

        public String getType()
        Returns:
        the type (e.g. "jar")
      • toArtifact

        public org.eclipse.aether.artifact.Artifact toArtifact​(String defaultVersion)
        Parameters:
        defaultVersion - the default version is none is defined
        Returns:
        the Artifact object
      • parseArtifacts

        public static ArtifactCoordinate parseArtifacts​(String coordinateAsString)
        Parse an Artifact coordinate as a String. Note that version is optional (as opposed to Aether's @link DefaultArtifact} implementation
        Parameters:
        coordinateAsString - the coordinate to parse (e.g. org.xwiki.contrib:myartifact or org.xwiki.contrib:myartifact:jar:1.0-SNAPSHOT or org.xwiki.contrib:myartifact:1.0-SNAPSHOT)
        Returns:
        the ArtifactCoordinate object representing the parsed string
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object