Class AbstractInstallMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
    Direct Known Subclasses:
    InstallFileMojo, InstallMojo

    public abstract class AbstractInstallMojo
    extends org.apache.maven.plugin.AbstractMojo
    Common fields for installation mojos.
    Version:
    $Id: AbstractInstallMojo.java 1530417 2013-10-08 20:49:56Z rfscholte $
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.apache.maven.artifact.factory.ArtifactFactory artifactFactory  
      protected boolean createChecksum
      Flag whether to create checksums (MD5, SHA-1) or not.
      protected DualDigester digester  
      protected org.apache.maven.artifact.installer.ArtifactInstaller installer  
      protected org.apache.maven.artifact.repository.ArtifactRepository localRepository  
      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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addMetaDataFilesForArtifact​(org.apache.maven.artifact.Artifact artifact, java.util.Collection<java.io.File> targetMetadataFiles, boolean createChecksum)  
      protected java.io.File getLocalRepoFile​(org.apache.maven.artifact.Artifact artifact)
      Gets the path of the specified artifact within the local repository.
      protected java.io.File getLocalRepoFile​(org.apache.maven.artifact.metadata.ArtifactMetadata metadata)
      Gets the path of the specified artifact metadata within the local repository.
      private void installChecksum​(java.io.File installedFile, java.lang.String ext, java.lang.String checksum)
      Installs a checksum for the specified file.
      private void installChecksums​(java.io.File installedFile)
      Installs the checksums for the specified file (if it exists).
      protected void installChecksums​(java.util.Collection<java.io.File> metadataFiles)
      Installs the checksums for the specified metadata files.
      protected void installChecksums​(org.apache.maven.artifact.Artifact artifact, boolean createChecksum)
      Installs the checksums for the specified artifact if this has been enabled in the plugin configuration.
      • 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 org.apache.maven.artifact.installer.ArtifactInstaller installer
      • localRepository

        @Parameter(property="localRepository",
                   required=true,
                   readonly=true)
        protected org.apache.maven.artifact.repository.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.
    • Constructor Detail

      • AbstractInstallMojo

        public AbstractInstallMojo()
    • Method Detail

      • getLocalRepoFile

        protected java.io.File getLocalRepoFile​(org.apache.maven.artifact.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 java.io.File getLocalRepoFile​(org.apache.maven.artifact.metadata.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​(org.apache.maven.artifact.Artifact artifact,
                                        boolean createChecksum)
                                 throws org.apache.maven.plugin.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.
        createChecksum - true if checksum should be created, otherwise false.
        Throws:
        org.apache.maven.plugin.MojoExecutionException - If the checksums could not be installed.
      • addMetaDataFilesForArtifact

        protected void addMetaDataFilesForArtifact​(org.apache.maven.artifact.Artifact artifact,
                                                   java.util.Collection<java.io.File> targetMetadataFiles,
                                                   boolean createChecksum)
      • installChecksums

        protected void installChecksums​(java.util.Collection<java.io.File> metadataFiles)
                                 throws org.apache.maven.plugin.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:
        org.apache.maven.plugin.MojoExecutionException - If the checksums could not be installed.
      • installChecksums

        private void installChecksums​(java.io.File installedFile)
                               throws org.apache.maven.plugin.MojoExecutionException
        Installs the checksums for the specified file (if it exists).
        Parameters:
        installedFile - The path to the already installed file in the local repo for which to generate checksums, must not be null.
        Throws:
        org.apache.maven.plugin.MojoExecutionException - If the checksums could not be installed.
      • installChecksum

        private void installChecksum​(java.io.File installedFile,
                                     java.lang.String ext,
                                     java.lang.String checksum)
                              throws org.apache.maven.plugin.MojoExecutionException
        Installs a checksum for the specified file.
        Parameters:
        installedFile - The base path from which the path to the checksum files is derived by appending the given file extension, must not be null.
        ext - The file extension (including the leading dot) to use for the checksum file, must not be null.
        checksum - the checksum to write
        Throws:
        org.apache.maven.plugin.MojoExecutionException - If the checksum could not be installed.