hudson.maven.reporters
Class MavenArtifact

java.lang.Object
  extended by hudson.maven.reporters.MavenArtifact
All Implemented Interfaces:
Serializable

public final class MavenArtifact
extends Object
implements Serializable

Captures information about an artifact created by Maven and archived by Hudson, 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 master, 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:
Serialized Form

Field Summary
 String artifactId
          Basic parameters of a Maven artifact.
 String canonicalName
          The canonical artifact file name, used by Maven in the repository.
 String classifier
          Basic parameters of a Maven artifact.
 String fileName
          File name (without directory portion) of this artifact in the Hudson archive.
 String groupId
          Basic parameters of a Maven artifact.
 String md5sum
          The md5sum for this artifact.
 String type
          Basic parameters of a Maven artifact.
 String version
          Basic parameters of a Maven artifact.
 
Constructor Summary
MavenArtifact(org.apache.maven.artifact.Artifact a)
           
MavenArtifact(String groupId, String artifactId, String version, String classifier, String type, String fileName, String md5sum)
           
 
Method Summary
 void 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 given Artifact object contains enough information suitable for recording, and if so, create MavenArtifact.
protected  File getFile(MavenBuild build)
          Obtains the File representing the archived artifact.
 boolean isPOM()
           
 void recordFingerprint(MavenBuild build)
          Called from within the master to record fingerprint.
 org.apache.maven.artifact.Artifact toArtifact(org.apache.maven.artifact.handler.manager.ArtifactHandlerManager handlerManager, org.apache.maven.artifact.factory.ArtifactFactory factory, MavenBuild build)
          Creates a Maven Artifact back from the persisted data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

groupId

public final String groupId
Basic parameters of a Maven artifact.


artifactId

public final String artifactId
Basic parameters of a Maven artifact.


version

public final String version
Basic parameters of a Maven artifact.


classifier

public final String classifier
Basic parameters of a Maven artifact.


type

public final String type
Basic parameters of a Maven artifact.


fileName

public final String 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 their finalName if one is configured.) This is often different from canonicalName.


canonicalName

public final String canonicalName
The canonical artifact file name, used by Maven in the repository. This is artifactId-version[-classifier].extension.

The reason we persist this is that the extension is only available through ArtifactHandler.


md5sum

public final String md5sum
The md5sum for this artifact.

Constructor Detail

MavenArtifact

public MavenArtifact(org.apache.maven.artifact.Artifact a)
              throws IOException
Throws:
IOException

MavenArtifact

public MavenArtifact(String groupId,
                     String artifactId,
                     String version,
                     String classifier,
                     String type,
                     String fileName,
                     String md5sum)
Method Detail

create

public static MavenArtifact create(org.apache.maven.artifact.Artifact a)
                            throws IOException
Convenience method to check if the given Artifact object contains enough information suitable for recording, and if so, create MavenArtifact.

Throws:
IOException

isPOM

public boolean isPOM()

toArtifact

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
Creates a Maven Artifact back from the persisted data.

Throws:
IOException

getFile

protected File getFile(MavenBuild build)
                throws IOException
Obtains the File representing the archived artifact.

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

recordFingerprint

public void recordFingerprint(MavenBuild build)
                       throws IOException
Called from within the master to record fingerprint.

Throws:
IOException


Copyright © 2004-2011. All Rights Reserved.