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
Nested ClassesModifier and TypeClassDescriptionstatic final classArtifactholder that can be released in afinally-block.final classRepresentation of an archived artifact that might be accessed in various ways. -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal StringBasic parameters of a Maven artifact.final StringThe canonical artifact file name, used by Maven in the repository.final StringBasic parameters of a Maven artifact.final StringFile name (without directory portion) of this artifact in the Hudson archive.final StringBasic parameters of a Maven artifact.final StringThe md5sum for this artifact.final StringBasic parameters of a Maven artifact.final StringBasic parameters of a Maven artifact. -
Constructor Summary
ConstructorsConstructorDescriptionMavenArtifact(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 TypeMethodDescriptionvoidarchive(MavenBuildProxy build, File file, BuildListener listener) Called from within Maven to archive an artifact in Hudson.static MavenArtifactcreate(org.apache.maven.artifact.Artifact a) Convenience method to check if the givenArtifactobject contains enough information suitable for recording, and if so, createMavenArtifact.org.kohsuke.stapler.HttpResponsedoFile(MavenArtifactRecord parent) Serve the file.getApi()getFile(MavenBuild build) Deprecated.getTemporaryFile(MavenBuild build) Gets an archived artifact.booleanisPOM()org.apache.maven.artifact.ArtifacttoArtifact(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 MavenArtifactback 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.xmland artifacts would use theirfinalNameif 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 givenArtifactobject 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 MavenArtifactback from the persisted data.- Throws:
IOException
-
getFile
Deprecated.only works withStandardArtifactManagerand subclasses; usegetTemporaryFile(hudson.maven.MavenBuild)insteadObtains theFilerepresenting 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:
IOExceptionInterruptedException
-
getApi
-
StandardArtifactManagerand subclasses; usegetTemporaryFile(hudson.maven.MavenBuild)instead