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  org.codehaus.plexus.archiver.manager.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 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.
 
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.
 org.codehaus.plexus.archiver.manager.ArchiverManager getArchiverManager()
           
 ArtifactCollector getArtifactCollector()
           
 ArtifactMetadataSource getArtifactMetadataSource()
           
 ArtifactFactory getFactory()
           
protected  ArtifactRepository getLocal()
           
 Log getLog()
           
 MavenProject getProject()
           
 List<ArtifactRepository> getRemoteRepos()
           
 ArtifactResolver getResolver()
           
 void setArchiverManager(org.codehaus.plexus.archiver.manager.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)
           
protected  void unpack(File file, File location)
           
protected  void unpack(File file, 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
 
Methods inherited from interface org.apache.maven.plugin.Mojo
execute
 

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 org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager
To look up Archiver/UnArchiver implementations


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

getLog

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

getArchiverManager

public org.codehaus.plexus.archiver.manager.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(File file,
                      File location)
               throws MojoExecutionException
Throws:
MojoExecutionException

unpack

protected void unpack(File file,
                      File location,
                      String includes,
                      String excludes)
               throws MojoExecutionException
Unpacks the archive file.

Parameters:
file - 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(org.codehaus.plexus.archiver.manager.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.


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