org.apache.maven.plugin.dependency
Class AbstractDependencyMojo

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

public abstract class AbstractDependencyMojo
extends AbstractMojo

Version:
$Id: AbstractDependencyMojo.java 552528 2007-07-02 16:12:47Z markh $
Author:
Brian Fox

Field Summary
protected  ArchiverManager archiverManager
          To look up Archiver/UnArchiver implementations
protected  ArtifactCollector artifactCollector
          Artifact collector, needed to resolve dependencies.
protected  ArtifactMetadataSource artifactMetadataSource
           
protected  ArtifactFactory factory
          Used to look up Artifacts in the remote repository.
protected  boolean ignorePermissions
          ignore to set file permissions when unpacking a dependency
protected  boolean outputAbsoluteArtifactFilename
          Output absolute filename for resolved artifacts
protected  MavenProject project
          POM
protected  List<MavenProject> reactorProjects
          Contains the full list of projects in the reactor.
protected  List<ArtifactRepository> remoteRepos
          List of Remote Repositories used by the resolver
protected  ArtifactResolver resolver
          Used to look up Artifacts in the remote repository.
 boolean silent
          If the plugin should be silent.
protected  boolean useJvmChmod
           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
AbstractDependencyMojo()
           
 
Method Summary
protected  void copyFile(File artifact, File destFile)
          Does the actual copy of the file and logging.
protected abstract  void doExecute()
           
 void execute()
           
 ArchiverManager getArchiverManager()
           
 ArtifactCollector getArtifactCollector()
           
 ArtifactMetadataSource getArtifactMetadataSource()
           
 ArtifactFactory getFactory()
           
protected  ArtifactRepository getLocal()
           
 Log getLog()
           
 MavenProject getProject()
           
 List<ArtifactRepository> getRemoteRepos()
           
 ArtifactResolver getResolver()
           
 boolean isSkip()
           
 boolean isUseJvmChmod()
           
 void setArchiverManager(ArchiverManager archiverManager)
           
 void setArtifactCollector(ArtifactCollector theArtifactCollector)
           
 void setArtifactMetadataSource(ArtifactMetadataSource theArtifactMetadataSource)
           
 void setFactory(ArtifactFactory factory)
           
 void setLocal(ArtifactRepository local)
           
 void setRemoteRepos(List<ArtifactRepository> remoteRepos)
           
 void setResolver(ArtifactResolver resolver)
           
 void setSkip(boolean skip)
           
 void setUseJvmChmod(boolean useJvmChmod)
           
protected  void unpack(Artifact artifact, File location)
           
protected  void unpack(Artifact artifact, File location, String includes, String excludes)
          Unpacks the archive file.
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

@Component
protected ArtifactFactory factory
Used to look up Artifacts in the remote repository.


resolver

@Component
protected ArtifactResolver resolver
Used to look up Artifacts in the remote repository.


artifactCollector

@Component(role=org.apache.maven.artifact.resolver.ArtifactCollector.class)
protected ArtifactCollector artifactCollector
Artifact collector, needed to resolve dependencies.


artifactMetadataSource

@Component(role=org.apache.maven.artifact.metadata.ArtifactMetadataSource.class,
           hint="maven")
protected ArtifactMetadataSource artifactMetadataSource

remoteRepos

@Parameter(defaultValue="${project.remoteArtifactRepositories}",
           readonly=true,
           required=true)
protected List<ArtifactRepository> remoteRepos
List of Remote Repositories used by the resolver


archiverManager

@Component
protected ArchiverManager archiverManager
To look up Archiver/UnArchiver implementations


useJvmChmod

@Parameter(property="dependency.useJvmChmod",
           defaultValue="true")
protected 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")
protected boolean ignorePermissions
ignore to set file permissions when unpacking a dependency

Since:
2.7

project

@Component
protected MavenProject project
POM


reactorProjects

@Parameter(defaultValue="${reactorProjects}")
protected List<MavenProject> reactorProjects
Contains the full list of projects in the reactor.


silent

@Parameter(property="silent",
           defaultValue="false")
public 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
Constructor Detail

AbstractDependencyMojo

public AbstractDependencyMojo()
Method Detail

execute

public final void execute()
                   throws MojoExecutionException,
                          MojoFailureException
Throws:
MojoExecutionException
MojoFailureException

doExecute

protected abstract void doExecute()
                           throws MojoExecutionException,
                                  MojoFailureException
Throws:
MojoExecutionException
MojoFailureException

getLog

public Log getLog()
Specified by:
getLog in interface Mojo
Overrides:
getLog in class AbstractMojo
Returns:
Returns the log.

getArchiverManager

public ArchiverManager getArchiverManager()
Returns:
Returns the archiverManager.

copyFile

protected void copyFile(File artifact,
                        File destFile)
                 throws MojoExecutionException
Does the actual copy of the file and logging.

Parameters:
artifact - represents the file to copy.
destFile - file name of destination file.
Throws:
MojoExecutionException - with a message if an error occurs.

unpack

protected void unpack(Artifact artifact,
                      File location)
               throws MojoExecutionException
Throws:
MojoExecutionException

unpack

protected void unpack(Artifact artifact,
                      File location,
                      String includes,
                      String excludes)
               throws 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
Throws:
MojoExecutionException

getFactory

public ArtifactFactory getFactory()
Returns:
Returns the factory.

setFactory

public void setFactory(ArtifactFactory factory)
Parameters:
factory - The factory to set.

getProject

public MavenProject getProject()
Returns:
Returns the project.

getLocal

protected ArtifactRepository getLocal()
Returns:
Returns the local.

setLocal

public void setLocal(ArtifactRepository local)
Parameters:
local - The local to set.

getRemoteRepos

public List<ArtifactRepository> getRemoteRepos()
Returns:
Returns the remoteRepos.

setRemoteRepos

public void setRemoteRepos(List<ArtifactRepository> remoteRepos)
Parameters:
remoteRepos - The remoteRepos to set.

getResolver

public ArtifactResolver getResolver()
Returns:
Returns the resolver.

setResolver

public void setResolver(ArtifactResolver resolver)
Parameters:
resolver - The resolver to set.

setArchiverManager

public void setArchiverManager(ArchiverManager archiverManager)
Parameters:
archiverManager - The archiverManager to set.

getArtifactCollector

public ArtifactCollector getArtifactCollector()
Returns:
Returns the artifactCollector.

setArtifactCollector

public void setArtifactCollector(ArtifactCollector theArtifactCollector)
Parameters:
theArtifactCollector - The artifactCollector to set.

getArtifactMetadataSource

public ArtifactMetadataSource getArtifactMetadataSource()
Returns:
Returns the artifactMetadataSource.

setArtifactMetadataSource

public void setArtifactMetadataSource(ArtifactMetadataSource theArtifactMetadataSource)
Parameters:
theArtifactMetadataSource - The artifactMetadataSource to set.

isUseJvmChmod

public boolean isUseJvmChmod()

setUseJvmChmod

public void setUseJvmChmod(boolean useJvmChmod)

isSkip

public boolean isSkip()

setSkip

public void setSkip(boolean skip)


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