Package hudson.maven.reporters
Class MavenArtifact
java.lang.Object
hudson.maven.reporters.MavenArtifact
- All Implemented Interfaces:
Serializable
Captures information about an artifact created by Maven and archived by
Jenkins, so that we can later deploy it to repositories of our choice.
This object is created within the Maven process and sent back to the controller, so it shouldn't contain anything non-serializable as fields.
Once it's constructed, the object should be considered final and immutable.
- Since:
- 1.189
- Author:
- Kohsuke Kawaguchi
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Artifact
holder that can be released in afinally
-block.final class
Representation of an archived artifact that might be accessed in various ways. -
Field Summary
Modifier and TypeFieldDescriptionfinal String
Basic parameters of a Maven artifact.final String
The canonical artifact file name, used by Maven in the repository.final String
Basic parameters of a Maven artifact.final String
File name (without directory portion) of this artifact in the Hudson archive.final String
Basic parameters of a Maven artifact.final String
The md5sum for this artifact.final String
Basic parameters of a Maven artifact.final String
Basic parameters of a Maven artifact. -
Constructor Summary
ConstructorDescriptionMavenArtifact
(String groupId, String artifactId, String version, String classifier, String type, String fileName, String md5sum) MavenArtifact
(org.apache.maven.artifact.Artifact a) -
Method Summary
Modifier and TypeMethodDescriptionvoid
archive
(MavenBuildProxy build, File file, BuildListener listener) Called from within Maven to archive an artifact in Hudson.static MavenArtifact
create
(org.apache.maven.artifact.Artifact a) Convenience method to check if the givenArtifact
object contains enough information suitable for recording, and if so, createMavenArtifact
.org.kohsuke.stapler.HttpResponse
doFile
(MavenArtifactRecord parent) Serve the file.getApi()
getFile
(MavenBuild build) Deprecated.getTemporaryFile
(MavenBuild build) Gets an archived artifact.boolean
isPOM()
org.apache.maven.artifact.Artifact
toArtifact
(org.apache.maven.artifact.handler.manager.ArtifactHandlerManager handlerManager, org.apache.maven.artifact.factory.ArtifactFactory factory, MavenBuild build) Deprecated.toCloseableArtifact
(org.apache.maven.artifact.handler.manager.ArtifactHandlerManager handlerManager, org.apache.maven.artifact.factory.ArtifactFactory factory, MavenBuild build) Creates a MavenArtifact
back from the persisted data.
-
Field Details
-
groupId
Basic parameters of a Maven artifact. -
artifactId
Basic parameters of a Maven artifact. -
version
Basic parameters of a Maven artifact. -
classifier
Basic parameters of a Maven artifact. -
type
Basic parameters of a Maven artifact. -
fileName
File name (without directory portion) of this artifact in the Hudson archive. Remembered explicitly because some times this doesn't follow the standard naming convention, due to<finalName>
setting in POM.This name is taken directly from the name of the file as used during the build (thus POM would be most likely just
pom.xml
and artifacts would use theirfinalName
if one is configured.) This is often different fromcanonicalName
. -
canonicalName
The canonical artifact file name, used by Maven in the repository. This isartifactId-version[-classifier].extension
.The reason we persist this is that the extension is only available through
ArtifactHandler
. -
md5sum
The md5sum for this artifact.
-
-
Constructor Details
-
MavenArtifact
- Throws:
IOException
-
MavenArtifact
-
-
Method Details
-
create
Convenience method to check if the givenArtifact
object contains enough information suitable for recording, and if so, createMavenArtifact
.- Throws:
IOException
-
isPOM
public boolean isPOM() -
toArtifact
@Deprecated public org.apache.maven.artifact.Artifact toArtifact(org.apache.maven.artifact.handler.manager.ArtifactHandlerManager handlerManager, org.apache.maven.artifact.factory.ArtifactFactory factory, MavenBuild build) throws IOException Deprecated.- Throws:
IOException
-
toCloseableArtifact
public MavenArtifact.CloseableArtifact toCloseableArtifact(org.apache.maven.artifact.handler.manager.ArtifactHandlerManager handlerManager, org.apache.maven.artifact.factory.ArtifactFactory factory, MavenBuild build) throws IOException Creates a MavenArtifact
back from the persisted data.- Throws:
IOException
-
getFile
Deprecated.only works withStandardArtifactManager
and subclasses; usegetTemporaryFile(hudson.maven.MavenBuild)
insteadObtains theFile
representing the archived artifact.- Throws:
FileNotFoundException
- if the archived artifact was missingIOException
-
getTemporaryFile
Gets an archived artifact.- Parameters:
build
- a Maven build that might have archived this- Returns:
- a representation of the artifact
- Since:
- 2.0.3
-
doFile
public org.kohsuke.stapler.HttpResponse doFile(@AncestorInPath MavenArtifactRecord parent) throws IOException Serve the file. TODO: figure out how to make this URL more discoverable to the remote API.- Throws:
IOException
-
archive
public void archive(MavenBuildProxy build, File file, BuildListener listener) throws IOException, InterruptedException Called from within Maven to archive an artifact in Hudson.- Throws:
IOException
InterruptedException
-
getApi
-
StandardArtifactManager
and subclasses; usegetTemporaryFile(hudson.maven.MavenBuild)
instead