Class MavenArtifact

java.lang.Object
org.jenkinsci.plugins.pipeline.maven.MavenArtifact
All Implemented Interfaces:
Serializable, Comparable<MavenArtifact>
Direct Known Subclasses:
MavenDependency

public class MavenArtifact extends Object implements Serializable, Comparable<MavenArtifact>
Author:
Cyrille Le Clerc
See Also:
  • Constructor Details

    • MavenArtifact

      public MavenArtifact()
    • MavenArtifact

      public MavenArtifact(String identifier) throws IllegalArgumentException
      Parameters:
      identifier - Maven $groupId:$artifactId:$version (GAV) or $groupId:$artifactId:$type:$version (GATV)
      Throws:
      IllegalArgumentException - unsupported identifier
  • Method Details

    • getFileName

      @NonNull public String getFileName()
      See Also:
      • version
    • getFileNameWithBaseVersion

      @NonNull public String getFileNameWithBaseVersion()
      See Also:
      • baseVersion
    • getFileNameWithVersion

      @NonNull public String getFileNameWithVersion()
      See Also:
      • baseVersion
    • getId

      @NonNull public String getId()
      org.apache.maven.artifact.Artifact#getId()
    • getShortDescription

      @NonNull public String getShortDescription()
      Gets a human readable description of this artifact
    • getUrl

      @Nullable public String getUrl()
      URL of the artifact on the maven repository on which it has been deployed if it has been deployed.
      Returns:
      URL of the artifact or null if the artifact has not been deployed (if "mvn deploy" was not invoked)
    • toString

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

      public int compareTo(MavenArtifact o)
      Specified by:
      compareTo in interface Comparable<MavenArtifact>
    • isDeployed

      public boolean isDeployed()
      Artifact has been deployed to a Maven repository ("mvn deploy")
      See Also:
    • hashCode

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

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

      public String getBaseVersion()
      Gets the base version of this artifact, for example "1.0-SNAPSHOT". In contrast to the org.eclipse.aether.artifact.Artifact#getVersion(), the base version will always refer to the unresolved meta version. org.eclipse.aether.artifact.Artifact#getBaseVersion()
    • setBaseVersion

      public void setBaseVersion(String baseVersion)
    • getVersion

      public String getVersion()
      Gets the version of this artifact, for example "1.0-20180318.225603-3". 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. org.eclipse.aether.artifact.Artifact#getVersion()
    • setVersion

      public void setVersion(String version)
    • getGroupId

      public String getGroupId()
    • setGroupId

      public void setGroupId(String groupId)
    • getArtifactId

      public String getArtifactId()
    • setArtifactId

      public void setArtifactId(String artifactId)
    • getType

      public String getType()
      Returns:
      The type of this artifact, for example "jar".
    • setType

      public void setType(String type)
    • getClassifier

      @Nullable public String getClassifier()
      Gets the classifier of this artifact, for example "sources".
      Returns:
      The classifier or null if none, never empty. org.eclipse.aether.artifact.Artifact#getClassifier()
    • setClassifier

      public void setClassifier(@Nullable String classifier)
    • getExtension

      public String getExtension()
      Extension of the generated file
      Returns:
      file extension (e.g. "jar", "war"...) org.eclipse.aether.artifact.Artifact#getExtension()
    • setExtension

      public void setExtension(String extension)
    • getFile

      @Nullable public String getFile()
      Not persisted in the database
      Returns:
      absolute path of the generated file in the build agent workspace
    • setFile

      public void setFile(@Nullable String file)
    • isSnapshot

      public boolean isSnapshot()
    • setSnapshot

      public void setSnapshot(boolean snapshot)
    • getRepositoryUrl

      @Nullable public String getRepositoryUrl()

      URL of the Maven repository on which the artifact has been deployed ("mvn deploy").

      Sample: "https://nexus.my-company.com/content/repositories/snapshots/"

    • setRepositoryUrl

      public void setRepositoryUrl(@Nullable String repositoryUrl)
      Parameters:
      repositoryUrl - URL of the maven repository the artifact was uploaded to.
      See Also: