Class AbstractDependencyMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.plugins.dependency.AbstractDependencyMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
AbstractDependencyFilterMojo, AbstractFromConfigurationMojo, ListRepositoriesMojo

public abstract class AbstractDependencyMojo extends org.apache.maven.plugin.AbstractMojo
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private org.codehaus.plexus.archiver.manager.ArchiverManager
    To look up Archiver/UnArchiver implementations
    private boolean
    ignore to set file permissions when unpacking a dependency
    protected boolean
    Output absolute filename for resolved artifacts
    private org.apache.maven.project.MavenProject
    POM
    protected List<org.apache.maven.project.MavenProject>
    Contains the full list of projects in the reactor.
    private List<org.apache.maven.artifact.repository.ArtifactRepository>
    Remote repositories which will be searched for plugins.
    private List<org.apache.maven.artifact.repository.ArtifactRepository>
    Remote repositories which will be searched for artifacts.
    protected org.apache.maven.execution.MavenSession
    The Maven session
    private boolean
    If the plugin should be silent.
    private boolean
    Skip plugin execution completely.
    private boolean
    will use the jvm chmod, this is available for user and all level group level will be ignored

    Fields inherited from interface org.apache.maven.plugin.Mojo

    ROLE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    copyFile(File artifact, File destFile)
    Does the actual copy of the file and logging.
    protected abstract void
     
    final void
     
    org.codehaus.plexus.archiver.manager.ArchiverManager
     
    org.apache.maven.project.MavenProject
     
    protected final boolean
     
    boolean
     
    boolean
     
    private void
    logUnpack(File file, File location, String includes, String excludes)
     
    private org.apache.maven.project.ProjectBuildingRequest
    newProjectBuildingRequest(List<org.apache.maven.artifact.repository.ArtifactRepository> repositories)
     
    org.apache.maven.project.ProjectBuildingRequest
     
    protected org.apache.maven.project.ProjectBuildingRequest
     
    void
    setArchiverManager(org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager)
     
    void
    setSilent(boolean silent)
     
    void
    setSkip(boolean skip)
     
    void
    setUseJvmChmod(boolean useJvmChmod)
     
    private void
    silenceUnarchiver(org.codehaus.plexus.archiver.UnArchiver unArchiver)
     
    protected void
    unpack(org.apache.maven.artifact.Artifact artifact, File location, String includes, String excludes, String encoding, org.codehaus.plexus.components.io.filemappers.FileMapper[] fileMappers)
    Unpacks the archive file.
    protected void
    unpack(org.apache.maven.artifact.Artifact artifact, File location, String encoding, org.codehaus.plexus.components.io.filemappers.FileMapper[] fileMappers)
     
    protected void
    unpack(org.apache.maven.artifact.Artifact artifact, String type, File location, String includes, String excludes, String encoding, org.codehaus.plexus.components.io.filemappers.FileMapper[] fileMappers)
     

    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
  • Field Details

    • archiverManager

      @Component private org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager
      To look up Archiver/UnArchiver implementations
    • useJvmChmod

      @Parameter(property="dependency.useJvmChmod", defaultValue="true") private boolean useJvmChmod

      will use the jvm chmod, this is available for user and all level group level will be ignored

      since 2.6 is on by default
      Since:
      2.5.1
    • ignorePermissions

      @Parameter(property="dependency.ignorePermissions", defaultValue="false") private boolean ignorePermissions
      ignore to set file permissions when unpacking a dependency
      Since:
      2.7
    • project

      @Parameter(defaultValue="${project}", readonly=true, required=true) private org.apache.maven.project.MavenProject project
      POM
    • remoteRepositories

      @Parameter(defaultValue="${project.remoteArtifactRepositories}", readonly=true, required=true) private List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepositories
      Remote repositories which will be searched for artifacts.
    • remotePluginRepositories

      @Parameter(defaultValue="${project.pluginArtifactRepositories}", readonly=true, required=true) private List<org.apache.maven.artifact.repository.ArtifactRepository> remotePluginRepositories
      Remote repositories which will be searched for plugins.
    • reactorProjects

      @Parameter(defaultValue="${reactorProjects}", readonly=true) protected List<org.apache.maven.project.MavenProject> reactorProjects
      Contains the full list of projects in the reactor.
    • session

      @Parameter(defaultValue="${session}", readonly=true, required=true) protected org.apache.maven.execution.MavenSession session
      The Maven session
    • silent

      @Parameter(property="silent", defaultValue="false") private boolean silent
      If the plugin should be silent.
      Since:
      2.0
    • outputAbsoluteArtifactFilename

      @Parameter(property="outputAbsoluteArtifactFilename", defaultValue="false") protected boolean outputAbsoluteArtifactFilename
      Output absolute filename for resolved artifacts
      Since:
      2.0
    • skip

      @Parameter(property="mdep.skip", defaultValue="false") private boolean skip
      Skip plugin execution completely.
      Since:
      2.7
  • Constructor Details

    • AbstractDependencyMojo

      public AbstractDependencyMojo()
  • Method Details

    • execute

      public final void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException
    • doExecute

      protected abstract void doExecute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoExecutionException - MojoExecutionException
      org.apache.maven.plugin.MojoFailureException - MojoFailureException
    • getArchiverManager

      public org.codehaus.plexus.archiver.manager.ArchiverManager getArchiverManager()
      Returns:
      Returns the archiverManager.
    • copyFile

      protected void copyFile(File artifact, File destFile) throws org.apache.maven.plugin.MojoExecutionException
      Does the actual copy of the file and logging.
      Parameters:
      artifact - represents the file to copy.
      destFile - file name of destination file.
      Throws:
      org.apache.maven.plugin.MojoExecutionException - with a message if an error occurs.
    • unpack

      protected void unpack(org.apache.maven.artifact.Artifact artifact, File location, String encoding, org.codehaus.plexus.components.io.filemappers.FileMapper[] fileMappers) throws org.apache.maven.plugin.MojoExecutionException
      Parameters:
      artifact - Artifact
      location - The location.
      encoding - The encoding.
      fileMappers - FileMappers to be used for rewriting each target path, or null if no rewriting shall happen.
      Throws:
      org.apache.maven.plugin.MojoExecutionException - in case of an error.
    • unpack

      protected void unpack(org.apache.maven.artifact.Artifact artifact, File location, String includes, String excludes, String encoding, org.codehaus.plexus.components.io.filemappers.FileMapper[] fileMappers) throws org.apache.maven.plugin.MojoExecutionException
      Unpacks the archive file.
      Parameters:
      artifact - File to be unpacked.
      location - Location where to put the unpacked files.
      includes - Comma separated list of file patterns to include i.e. **/.xml, **/*.properties
      excludes - Comma separated list of file patterns to exclude i.e. **/*.xml, **/*.properties
      encoding - Encoding of artifact. Set null for default encoding.
      fileMappers - FileMappers to be used for rewriting each target path, or null if no rewriting shall happen.
      Throws:
      org.apache.maven.plugin.MojoExecutionException - In case of errors.
    • unpack

      protected void unpack(org.apache.maven.artifact.Artifact artifact, String type, File location, String includes, String excludes, String encoding, org.codehaus.plexus.components.io.filemappers.FileMapper[] fileMappers) throws org.apache.maven.plugin.MojoExecutionException
      Parameters:
      artifact - Artifact
      type - The type.
      location - The location.
      includes - includes list.
      excludes - excludes list.
      encoding - the encoding.
      fileMappers - FileMappers to be used for rewriting each target path, or null if no rewriting shall happen.
      Throws:
      org.apache.maven.plugin.MojoExecutionException - in case of an error.
    • silenceUnarchiver

      private void silenceUnarchiver(org.codehaus.plexus.archiver.UnArchiver unArchiver)
    • newResolveArtifactProjectBuildingRequest

      public org.apache.maven.project.ProjectBuildingRequest newResolveArtifactProjectBuildingRequest()
      Returns:
      Returns a new ProjectBuildingRequest populated from the current session and the current project remote repositories, used to resolve artifacts.
    • newResolvePluginProjectBuildingRequest

      protected org.apache.maven.project.ProjectBuildingRequest newResolvePluginProjectBuildingRequest()
      Returns:
      Returns a new ProjectBuildingRequest populated from the current session and the current project remote repositories, used to resolve plugins.
    • newProjectBuildingRequest

      private org.apache.maven.project.ProjectBuildingRequest newProjectBuildingRequest(List<org.apache.maven.artifact.repository.ArtifactRepository> repositories)
    • getProject

      public org.apache.maven.project.MavenProject getProject()
      Returns:
      Returns the project.
    • setArchiverManager

      public void setArchiverManager(org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager)
      Parameters:
      archiverManager - The archiverManager to set.
    • isUseJvmChmod

      public boolean isUseJvmChmod()
      Returns:
      useJvmChmod
    • setUseJvmChmod

      public void setUseJvmChmod(boolean useJvmChmod)
      Parameters:
      useJvmChmod - useJvmChmod
    • isSkip

      public boolean isSkip()
      Returns:
      skip
    • setSkip

      public void setSkip(boolean skip)
      Parameters:
      skip - skip
    • isSilent

      protected final boolean isSilent()
      Returns:
      silent
    • setSilent

      public void setSilent(boolean silent)
      Parameters:
      silent - silent
    • logUnpack

      private void logUnpack(File file, File location, String includes, String excludes)