Class AbstractFromConfigurationMojo

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

    public abstract class AbstractFromConfigurationMojo
    extends AbstractDependencyMojo
    Abstract parent class used by mojos that get Artifact information from the plugin configuration as an ArrayList of ArtifactItems
    Author:
    Brian Fox
    See Also:
    ArtifactItem
    • Constructor Detail

      • AbstractFromConfigurationMojo

        public AbstractFromConfigurationMojo()
    • Method Detail

      • verifyRequirements

        protected void verifyRequirements()
                                   throws org.apache.maven.plugin.MojoFailureException
        artifactItems is filled by either field injection or by setArtifact().
        Throws:
        org.apache.maven.plugin.MojoFailureException - in case of an error.
      • getProcessedArtifactItems

        protected List<ArtifactItem> getProcessedArtifactItems​(ProcessArtifactItemsRequest processArtifactItemsRequest)
                                                        throws org.apache.maven.plugin.MojoExecutionException
        Preprocesses the list of ArtifactItems. This method defaults the outputDirectory if not set and creates the output Directory if it doesn't exist.
        Parameters:
        processArtifactItemsRequest - preprocessing instructions
        Returns:
        An ArrayList of preprocessed ArtifactItems
        Throws:
        org.apache.maven.plugin.MojoExecutionException - with a message if an error occurs.
        See Also:
        ArtifactItem
      • getArtifact

        protected org.apache.maven.artifact.Artifact getArtifact​(ArtifactItem artifactItem)
                                                          throws org.apache.maven.plugin.MojoExecutionException
        Resolves the Artifact from the remote repository if necessary. If no version is specified, it will be retrieved from the dependency list or from the DependencyManagement section of the pom.
        Parameters:
        artifactItem - containing information about artifact from plugin configuration.
        Returns:
        Artifact object representing the specified file.
        Throws:
        org.apache.maven.plugin.MojoExecutionException - with a message if the version can't be found in DependencyManagement.
      • getArtifactItems

        public List<ArtifactItem> getArtifactItems()
        Returns:
        Returns the artifactItems.
      • setArtifactItems

        public void setArtifactItems​(List<ArtifactItem> theArtifactItems)
        Parameters:
        theArtifactItems - The artifactItems to set.
      • getOutputDirectory

        public File getOutputDirectory()
        Returns:
        Returns the outputDirectory.
      • setOutputDirectory

        public void setOutputDirectory​(File theOutputDirectory)
        Parameters:
        theOutputDirectory - The outputDirectory to set.
      • isOverWriteIfNewer

        public boolean isOverWriteIfNewer()
        Returns:
        Returns the overWriteIfNewer.
      • setOverWriteIfNewer

        public void setOverWriteIfNewer​(boolean theOverWriteIfNewer)
        Parameters:
        theOverWriteIfNewer - The overWriteIfNewer to set.
      • isOverWriteReleases

        public boolean isOverWriteReleases()
        Returns:
        Returns the overWriteReleases.
      • setOverWriteReleases

        public void setOverWriteReleases​(boolean theOverWriteReleases)
        Parameters:
        theOverWriteReleases - The overWriteReleases to set.
      • isOverWriteSnapshots

        public boolean isOverWriteSnapshots()
        Returns:
        Returns the overWriteSnapshots.
      • setOverWriteSnapshots

        public void setOverWriteSnapshots​(boolean theOverWriteSnapshots)
        Parameters:
        theOverWriteSnapshots - The overWriteSnapshots to set.
      • setLocalRepositoryDirectory

        public void setLocalRepositoryDirectory​(File localRepositoryDirectory)
        Parameters:
        localRepositoryDirectory - localRepositoryDirectory
      • setArtifact

        public void setArtifact​(String artifact)
                         throws org.apache.maven.plugin.MojoFailureException
        Parameters:
        artifact - The artifact.
        Throws:
        org.apache.maven.plugin.MojoFailureException - in case of an error.