org.apache.maven.plugin.install
Class AbstractInstallMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.plugin.install.AbstractInstallMojo
All Implemented Interfaces:
ContextEnabled, Mojo
Direct Known Subclasses:
InstallFileMojo, InstallMojo

public abstract class AbstractInstallMojo
extends AbstractMojo

Common fields for installation mojos.

Version:
$Id: AbstractInstallMojo.html 846653 2013-01-14 19:34:23Z rfscholte $
Author:
Brett Porter

Field Summary
protected  org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
           
protected  boolean createChecksum
          Flag whether to create checksums (MD5, SHA-1) or not.
protected  ArtifactInstaller installer
           
protected  ArtifactRepository localRepository
           
protected  org.codehaus.plexus.digest.Digester md5Digester
          Digester for MD5.
protected  org.codehaus.plexus.digest.Digester sha1Digester
          Digester for SHA-1.
protected  boolean updateReleaseInfo
          Whether to update the metadata to make the artifact a release version.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractInstallMojo()
           
 
Method Summary
protected  File getLocalRepoFile(Artifact artifact)
          Gets the path of the specified artifact within the local repository.
protected  File getLocalRepoFile(ArtifactMetadata metadata)
          Gets the path of the specified artifact metadata within the local repository.
protected  void installChecksums(Artifact artifact, Collection metadataFiles)
          Installs the checksums for the specified artifact if this has been enabled in the plugin configuration.
protected  void installChecksums(Collection metadataFiles)
          Installs the checksums for the specified metadata files.
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.maven.plugin.Mojo
execute
 

Field Detail

artifactFactory

@Component
protected org.apache.maven.artifact.factory.ArtifactFactory artifactFactory

installer

@Component
protected ArtifactInstaller installer

localRepository

@Parameter(property="localRepository",
           required=true,
           readonly=true)
protected ArtifactRepository localRepository

createChecksum

@Parameter(property="createChecksum",
           defaultValue="false")
protected boolean createChecksum
Flag whether to create checksums (MD5, SHA-1) or not.

Since:
2.2

updateReleaseInfo

@Parameter(property="updateReleaseInfo",
           defaultValue="false")
protected boolean updateReleaseInfo
Whether to update the metadata to make the artifact a release version.


md5Digester

@Component(hint="md5")
protected org.codehaus.plexus.digest.Digester md5Digester
Digester for MD5.


sha1Digester

@Component(hint="sha1")
protected org.codehaus.plexus.digest.Digester sha1Digester
Digester for SHA-1.

Constructor Detail

AbstractInstallMojo

public AbstractInstallMojo()
Method Detail

getLocalRepoFile

protected File getLocalRepoFile(Artifact artifact)
Gets the path of the specified artifact within the local repository. Note that the returned path need not exist (yet).

Parameters:
artifact - The artifact whose local repo path should be determined, must not be null.
Returns:
The absolute path to the artifact when installed, never null.

getLocalRepoFile

protected File getLocalRepoFile(ArtifactMetadata metadata)
Gets the path of the specified artifact metadata within the local repository. Note that the returned path need not exist (yet).

Parameters:
metadata - The artifact metadata whose local repo path should be determined, must not be null.
Returns:
The absolute path to the artifact metadata when installed, never null.

installChecksums

protected void installChecksums(Artifact artifact,
                                Collection metadataFiles)
                         throws MojoExecutionException
Installs the checksums for the specified artifact if this has been enabled in the plugin configuration. This method creates checksums for files that have already been installed to the local repo to account for on-the-fly generated/updated files. For example, in Maven 2.0.4- the ProjectArtifactMetadata did not install the original POM file (cf. MNG-2820). While the plugin currently requires Maven 2.0.6, we continue to hash the installed POM for robustness with regard to future changes like re-introducing some kind of POM filtering.

Parameters:
artifact - The artifact for which to create checksums, must not be null.
metadataFiles - The set where additional metadata files will be registered for later checksum installation, must not be null.
Throws:
MojoExecutionException - If the checksums could not be installed.

installChecksums

protected void installChecksums(Collection metadataFiles)
                         throws MojoExecutionException
Installs the checksums for the specified metadata files.

Parameters:
metadataFiles - The collection of metadata files to install checksums for, must not be null.
Throws:
MojoExecutionException - If the checksums could not be installed.


Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.