public class MavenArtifact extends Object implements Comparable<MavenArtifact>
Artifact is a bare data structure without any behavior and therefore
hard to write OO programs around it.
This class wraps Artifact and adds behaviours.| Modifier and Type | Field and Description |
|---|---|
org.apache.maven.artifact.Artifact |
artifact |
org.apache.maven.artifact.factory.ArtifactFactory |
artifactFactory |
org.apache.maven.project.ProjectBuilder |
builder |
org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver |
resolver |
org.apache.maven.execution.MavenSession |
session |
| Constructor and Description |
|---|
MavenArtifact(org.apache.maven.artifact.Artifact artifact,
org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver resolver,
org.apache.maven.artifact.factory.ArtifactFactory artifactFactory,
org.apache.maven.project.ProjectBuilder builder,
org.apache.maven.execution.MavenSession session) |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(MavenArtifact o) |
String |
getActualArtifactId()
For a plugin artifact, unlike
getArtifactId() this parses the plugin manifest. |
String |
getActualVersion()
For a plugin artifact, unlike
getVersion() this parses the plugin manifest. |
String |
getArtifactId()
Gets the
artifactId as used in a dependency declaration. |
String |
getClassifier() |
String |
getDefaultFinalName()
Converts the filename of an artifact to artifactId-version.type format.
|
List<String> |
getDependencyTrail() |
File |
getFile()
Resolves to the jar file that contains the code of the plugin.
|
String |
getGroupId() |
MavenArtifact |
getHpi()
Returns
MavenArtifact for the hpi variant of this artifact. |
String |
getId() |
String |
getScope() |
String |
getType() |
String |
getVersion()
Gets the
version as used in a dependency declaration. |
org.apache.maven.artifact.versioning.ArtifactVersion |
getVersionNumber() |
boolean |
hasSameGAAs(org.apache.maven.project.MavenProject project)
Returns true if this artifact has the same groupId and artifactId as the given project.
|
boolean |
hasScope(String... scopes)
Returns true if the artifacts has one of the given scopes (including null.)
|
boolean |
isNewerThan(MavenArtifact rhs) |
boolean |
isOptional() |
boolean |
isPlugin()
Is this a Jenkins plugin?
|
boolean |
isPluginBestEffort(org.apache.maven.plugin.logging.Log log)
Like
isPlugin() but will not throw an exception if the project model cannot be resolved. |
org.apache.maven.project.MavenProject |
resolvePom() |
String |
toString() |
public final org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
public final org.apache.maven.project.ProjectBuilder builder
public final org.apache.maven.artifact.Artifact artifact
public final org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver resolver
public final org.apache.maven.execution.MavenSession session
public MavenArtifact(org.apache.maven.artifact.Artifact artifact,
org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver resolver,
org.apache.maven.artifact.factory.ArtifactFactory artifactFactory,
org.apache.maven.project.ProjectBuilder builder,
org.apache.maven.execution.MavenSession session)
public org.apache.maven.project.MavenProject resolvePom()
throws org.apache.maven.project.ProjectBuildingException
org.apache.maven.project.ProjectBuildingExceptionpublic boolean isPlugin()
throws IOException
IOExceptionpublic boolean isPluginBestEffort(org.apache.maven.plugin.logging.Log log)
isPlugin() but will not throw an exception if the project model cannot be resolved.
Helpful for example when an indirect dependency has a bogus systemPath that is only rejected in some environments.public String getId()
public String getDefaultFinalName()
public boolean isOptional()
public String getType()
public File getFile()
public MavenArtifact getHpi() throws IOException
MavenArtifact for the hpi variant of this artifact.IOExceptionpublic String getGroupId()
public String getScope()
public boolean hasScope(String... scopes)
public String getArtifactId()
artifactId as used in a dependency declaration. For a plugin artifact this need not be be a plugin short name.public String getVersion()
version as used in a dependency declaration. For a plugin artifact this need not be be a plugin version number.public String getClassifier()
public String getActualArtifactId() throws IOException
getArtifactId() this parses the plugin manifest.IOExceptionpublic String getActualVersion() throws IOException
getVersion() this parses the plugin manifest.IOExceptionpublic org.apache.maven.artifact.versioning.ArtifactVersion getVersionNumber()
throws org.apache.maven.artifact.versioning.OverConstrainedVersionException
org.apache.maven.artifact.versioning.OverConstrainedVersionExceptionpublic boolean hasSameGAAs(org.apache.maven.project.MavenProject project)
public boolean isNewerThan(MavenArtifact rhs)
public int compareTo(MavenArtifact o)
compareTo in interface Comparable<MavenArtifact>Copyright © 2004–2022. All rights reserved.