Class CopyMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugins.dependency.AbstractDependencyMojo
-
- org.apache.maven.plugins.dependency.fromConfiguration.AbstractFromConfigurationMojo
-
- org.apache.maven.plugins.dependency.fromConfiguration.CopyMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="copy", defaultPhase=PROCESS_SOURCES, requiresProject=false, threadSafe=true) public class CopyMojo extends AbstractFromConfigurationMojoGoal that copies a list of artifacts from the repository to defined locations.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringartifactThe artifact to copy from command line.private CopyUtilcopyUtilprivate booleanprependGroupIdPrepend artifact groupId during copy.private booleanstripClassifierStrip artifact classifier during copy.private booleanstripVersionStrip artifact version during copy.private booleanuseBaseVersionUse artifact baseVersion during copy.-
Fields inherited from class org.apache.maven.plugins.dependency.AbstractDependencyMojo
session
-
-
Constructor Summary
Constructors Constructor Description CopyMojo(org.apache.maven.execution.MavenSession session, org.sonatype.plexus.build.incremental.BuildContext buildContext, org.apache.maven.project.MavenProject project, org.apache.maven.artifact.handler.manager.ArtifactHandlerManager artifactHandlerManager, CopyUtil copyUtil, org.eclipse.aether.RepositorySystem repositorySystem)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcopyArtifact(ArtifactItem artifactItem)Resolves the artifact from the repository and copies it to the specified location.protected voiddoExecute()Main entry into mojo.protected ArtifactItemFiltergetMarkedArtifactFilter(ArtifactItem item)booleanisStripClassifier()booleanisStripVersion()voidsetStripClassifier(boolean stripClassifier)voidsetStripVersion(boolean stripVersion)voidsetUseBaseVersion(boolean useBaseVersion)-
Methods inherited from class org.apache.maven.plugins.dependency.fromConfiguration.AbstractFromConfigurationMojo
getArtifact, getArtifactItems, getOutputDirectory, getProcessedArtifactItems, isOverWriteIfNewer, isOverWriteReleases, isOverWriteSnapshots, setArtifact, setArtifactItems, setLocalRepositoryDirectory, setOutputDirectory, setOverWriteIfNewer, setOverWriteReleases, setOverWriteSnapshots, verifyRequirements
-
Methods inherited from class org.apache.maven.plugins.dependency.AbstractDependencyMojo
execute, getProject, isSilent, isSkip, setSilent, setSkip
-
-
-
-
Field Detail
-
copyUtil
private final CopyUtil copyUtil
-
stripVersion
@Parameter(property="mdep.stripVersion", defaultValue="false") private boolean stripVersionStrip artifact version during copy.
-
stripClassifier
@Parameter(property="mdep.stripClassifier", defaultValue="false") private boolean stripClassifierStrip artifact classifier during copy.
-
prependGroupId
@Parameter(property="mdep.prependGroupId", defaultValue="false") private boolean prependGroupIdPrepend artifact groupId during copy.- Since:
- 2.7
-
useBaseVersion
@Parameter(property="mdep.useBaseVersion", defaultValue="false") private boolean useBaseVersionUse artifact baseVersion during copy.- Since:
- 2.7
-
artifact
@Parameter(property="artifact") private java.lang.String artifact
The artifact to copy from command line. A string of the form groupId:artifactId:version[:packaging[:classifier]]. UseAbstractFromConfigurationMojo.artifactItemswithin the POM configuration.
-
-
Constructor Detail
-
CopyMojo
@Inject public CopyMojo(org.apache.maven.execution.MavenSession session, org.sonatype.plexus.build.incremental.BuildContext buildContext, org.apache.maven.project.MavenProject project, org.apache.maven.artifact.handler.manager.ArtifactHandlerManager artifactHandlerManager, CopyUtil copyUtil, org.eclipse.aether.RepositorySystem repositorySystem)
-
-
Method Detail
-
doExecute
protected void doExecute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureExceptionMain entry into mojo. This method gets the ArtifactItems and iterates through each one passing it to copyArtifact.- Specified by:
doExecutein classAbstractDependencyMojo- Throws:
org.apache.maven.plugin.MojoExecutionException- with a message if an error occursorg.apache.maven.plugin.MojoFailureException-MojoFailureException- See Also:
ArtifactItem,AbstractFromConfigurationMojo.getArtifactItems(),copyArtifact(ArtifactItem)
-
copyArtifact
protected void copyArtifact(ArtifactItem artifactItem) throws org.apache.maven.plugin.MojoExecutionException
Resolves the artifact from the repository and copies it to the specified location.- Parameters:
artifactItem- containing the information about the artifact to copy- Throws:
org.apache.maven.plugin.MojoExecutionException- with a message if an error occurs- See Also:
CopyUtil.copyArtifactFile(Artifact, File)
-
getMarkedArtifactFilter
protected ArtifactItemFilter getMarkedArtifactFilter(ArtifactItem item)
- Specified by:
getMarkedArtifactFilterin classAbstractFromConfigurationMojo
-
isStripVersion
public boolean isStripVersion()
- Returns:
- returns the stripVersion
-
setStripVersion
public void setStripVersion(boolean stripVersion)
- Parameters:
stripVersion- the stripVersion to set
-
isStripClassifier
public boolean isStripClassifier()
- Returns:
- returns the stripClassifier
-
setStripClassifier
public void setStripClassifier(boolean stripClassifier)
- Parameters:
stripClassifier- the stripClassifier to set
-
setUseBaseVersion
public void setUseBaseVersion(boolean useBaseVersion)
- Parameters:
useBaseVersion- the useBaseVersion to set
-
-