org.apache.maven.plugin.dependency
Class CopyDependenciesMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.plugin.dependency.AbstractDependencyMojo
          extended by org.apache.maven.plugin.dependency.AbstractDependencyFilterMojo
              extended by org.apache.maven.plugin.dependency.AbstractFromDependenciesMojo
                  extended by org.apache.maven.plugin.dependency.CopyDependenciesMojo
All Implemented Interfaces:
ContextEnabled, Mojo

@Mojo(name="copy-dependencies",
      requiresDependencyResolution=TEST,
      defaultPhase=PROCESS_SOURCES,
      threadSafe=true)
public class CopyDependenciesMojo
extends AbstractFromDependenciesMojo

Goal that copies the project dependencies from the repository to a defined location.

Since:
1.0
Version:
$Id: CopyDependenciesMojo.java 1451088 2013-02-28 04:22:41Z brianf $
Author:
Brian Fox

Field Summary
protected  ArtifactInstaller installer
           
protected  ArtifactRepositoryFactory repositoryFactory
           
protected  boolean useBaseVersion
          Either append the artifact's baseVersion or uniqueVersion to the filename.
 
Fields inherited from class org.apache.maven.plugin.dependency.AbstractFromDependenciesMojo
copyPom, failOnMissingClassifierArtifact, outputDirectory, stripVersion, useRepositoryLayout, useSubDirectoryPerArtifact, useSubDirectoryPerScope, useSubDirectoryPerType
 
Fields inherited from class org.apache.maven.plugin.dependency.AbstractDependencyFilterMojo
classifier, excludeArtifactIds, excludeClassifiers, excludeGroupIds, excludeScope, excludeTransitive, excludeTypes, includeArtifactIds, includeClassifiers, includeGroupIds, includeScope, includeTypes, markersDirectory, overWriteIfNewer, overWriteReleases, overWriteSnapshots, prependGroupId, type
 
Fields inherited from class org.apache.maven.plugin.dependency.AbstractDependencyMojo
archiverManager, artifactCollector, artifactMetadataSource, factory, ignorePermissions, outputAbsoluteArtifactFilename, project, reactorProjects, remoteRepos, resolver, silent, useJvmChmod
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
CopyDependenciesMojo()
           
 
Method Summary
protected  void copyArtifact(Artifact artifact, boolean removeVersion, boolean prependGroupId, boolean useBaseVersion)
          Copies the Artifact after building the destination file name if overridden.
 void copyPoms(File destDir, Set<Artifact> artifacts, boolean removeVersion)
          Copy the pom files associated with the artifacts.
protected  void doExecute()
          Main entry into mojo.
protected  ArtifactsFilter getMarkedArtifactFilter()
          Return an ArtifactsFilter indicating which artifacts must be filtered out.
protected  Artifact getResolvedPomArtifact(Artifact artifact)
           
 
Methods inherited from class org.apache.maven.plugin.dependency.AbstractFromDependenciesMojo
getOutputDirectory, isCopyPom, isFailOnMissingClassifierArtifact, isStripVersion, isUseRepositoryLayout, isUseSubDirectoryPerArtifact, isUseSubDirectoryPerScope, isUseSubDirectoryPerType, setCopyPom, setFailOnMissingClassifierArtifact, setOutputDirectory, setStripVersion, setUseRepositoryLayout, setUseSubDirectoryPerArtifact, setUseSubDirectoryPerScope, setUseSubDirectoryPerType
 
Methods inherited from class org.apache.maven.plugin.dependency.AbstractDependencyFilterMojo
filterMarkedDependencies, getClassifierTranslatedDependencies, getDependencySets, getMarkersDirectory, getResolvedDependencies, isPrependGroupId, setMarkersDirectory, setPrependGroupId
 
Methods inherited from class org.apache.maven.plugin.dependency.AbstractDependencyMojo
copyFile, execute, getArchiverManager, getArtifactCollector, getArtifactMetadataSource, getFactory, getLocal, getLog, getProject, getRemoteRepos, getResolver, isSkip, isUseJvmChmod, setArchiverManager, setArtifactCollector, setArtifactMetadataSource, setFactory, setLocal, setRemoteRepos, setResolver, setSkip, setUseJvmChmod, unpack, unpack
 
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

installer

@Component
protected ArtifactInstaller installer

repositoryFactory

@Component
protected ArtifactRepositoryFactory repositoryFactory

useBaseVersion

@Parameter(property="mdep.useBaseVersion",
           defaultValue="true")
protected boolean useBaseVersion
Either append the artifact's baseVersion or uniqueVersion to the filename. Will only be used if AbstractFromDependenciesMojo.isStripVersion() is false.

Since:
2.6
Constructor Detail

CopyDependenciesMojo

public CopyDependenciesMojo()
Method Detail

doExecute

protected void doExecute()
                  throws MojoExecutionException
Main entry into mojo. Gets the list of dependencies and iterates through calling copyArtifact.

Specified by:
doExecute in class AbstractDependencyMojo
Throws:
MojoExecutionException - with a message if an error occurs.
See Also:
#getDependencies, #copyArtifact(Artifact, boolean)

copyArtifact

protected void copyArtifact(Artifact artifact,
                            boolean removeVersion,
                            boolean prependGroupId,
                            boolean useBaseVersion)
                     throws MojoExecutionException
Copies the Artifact after building the destination file name if overridden. This method also checks if the classifier is set and adds it to the destination file name if needed.

Parameters:
artifact - representing the object to be copied.
removeVersion - specifies if the version should be removed from the file name when copying.
prependGroupId - specifies if the groupId should be prepend to the file while copying.
useBaseVersion - specifies if the baseVersion of the artifact should be used instead of the version.
Throws:
MojoExecutionException - with a message if an error occurs.
See Also:
DependencyUtil#copyFile(File, File, Log), DependencyUtil.getFormattedFileName(Artifact, boolean)

copyPoms

public void copyPoms(File destDir,
                     Set<Artifact> artifacts,
                     boolean removeVersion)
              throws MojoExecutionException
Copy the pom files associated with the artifacts.

Throws:
MojoExecutionException

getResolvedPomArtifact

protected Artifact getResolvedPomArtifact(Artifact artifact)

getMarkedArtifactFilter

protected ArtifactsFilter getMarkedArtifactFilter()
Description copied from class: AbstractDependencyFilterMojo
Return an ArtifactsFilter indicating which artifacts must be filtered out.

Specified by:
getMarkedArtifactFilter in class AbstractDependencyFilterMojo
Returns:
an ArtifactsFilter indicating which artifacts must be filtered out.


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