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 SummaryNested 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 SummaryFieldsModifier 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 SummaryConstructorsConstructorDescriptionMavenArtifact(String groupId, String artifactId, String version, String classifier, String type, String fileName, String md5sum) MavenArtifact(org.apache.maven.artifact.Artifact a) 
- 
Method SummaryModifier 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- 
groupIdBasic parameters of a Maven artifact.
- 
artifactIdBasic parameters of a Maven artifact.
- 
versionBasic parameters of a Maven artifact.
- 
classifierBasic parameters of a Maven artifact.
- 
typeBasic parameters of a Maven artifact.
- 
fileNameFile 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.
- 
canonicalNameThe 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.
- 
md5sumThe md5sum for this artifact.
 
- 
- 
Constructor Details- 
MavenArtifact- Throws:
- IOException
 
- 
MavenArtifact
 
- 
- 
Method Details- 
createConvenience method to check if the givenArtifactobject contains enough information suitable for recording, and if so, createMavenArtifact.- Throws:
- IOException
 
- 
isPOMpublic 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
 
- 
toCloseableArtifactpublic 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
 
- 
getFileDeprecated.only works withStandardArtifactManagerand subclasses; usegetTemporaryFile(hudson.maven.MavenBuild)insteadObtains theFilerepresenting the archived artifact.- Throws:
- FileNotFoundException- if the archived artifact was missing
- IOException
 
- 
getTemporaryFileGets an archived artifact.- Parameters:
- build- a Maven build that might have archived this
- Returns:
- a representation of the artifact
- Since:
- 2.0.3
 
- 
doFilepublic 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
 
- 
archivepublic 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
 
- 
StandardArtifactManagerand subclasses; usegetTemporaryFile(hudson.maven.MavenBuild)instead