Class AbstractFromConfigurationMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugins.dependency.AbstractDependencyMojo
-
- org.apache.maven.plugins.dependency.fromConfiguration.AbstractFromConfigurationMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
CopyMojo
,UnpackMojo
public abstract class AbstractFromConfigurationMojo extends AbstractDependencyMojo
Abstract parent class used by mojos that get Artifact information from the plugin configuration as an ArrayList of ArtifactItems- Author:
- Brian Fox
- See Also:
ArtifactItem
-
-
Field Summary
-
Fields inherited from class org.apache.maven.plugins.dependency.AbstractDependencyMojo
outputAbsoluteArtifactFilename, reactorProjects, session
-
-
Constructor Summary
Constructors Constructor Description AbstractFromConfigurationMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.maven.artifact.Artifact
getArtifact(ArtifactItem artifactItem)
Resolves the Artifact from the remote repository if necessary.List<ArtifactItem>
getArtifactItems()
File
getOutputDirectory()
protected List<ArtifactItem>
getProcessedArtifactItems(ProcessArtifactItemsRequest processArtifactItemsRequest)
Preprocesses the list of ArtifactItems.boolean
isOverWriteIfNewer()
boolean
isOverWriteReleases()
boolean
isOverWriteSnapshots()
void
setArtifact(String artifact)
void
setArtifactItems(List<ArtifactItem> theArtifactItems)
void
setLocalRepositoryDirectory(File localRepositoryDirectory)
void
setOutputDirectory(File theOutputDirectory)
void
setOverWriteIfNewer(boolean theOverWriteIfNewer)
void
setOverWriteReleases(boolean theOverWriteReleases)
void
setOverWriteSnapshots(boolean theOverWriteSnapshots)
protected void
verifyRequirements()
artifactItems is filled by either field injection or by setArtifact().-
Methods inherited from class org.apache.maven.plugins.dependency.AbstractDependencyMojo
copyFile, doExecute, execute, getArchiverManager, getProject, isSilent, isSkip, isUseJvmChmod, newResolveArtifactProjectBuildingRequest, setArchiverManager, setSilent, setSkip, setUseJvmChmod, unpack, unpack, unpack
-
-
-
-
Method Detail
-
verifyRequirements
protected void verifyRequirements() throws org.apache.maven.plugin.MojoFailureException
artifactItems is filled by either field injection or by setArtifact().- Throws:
org.apache.maven.plugin.MojoFailureException
- in case of an error.
-
getProcessedArtifactItems
protected List<ArtifactItem> getProcessedArtifactItems(ProcessArtifactItemsRequest processArtifactItemsRequest) throws org.apache.maven.plugin.MojoExecutionException
Preprocesses the list of ArtifactItems. This method defaults the outputDirectory if not set and creates the output Directory if it doesn't exist.- Parameters:
processArtifactItemsRequest
- preprocessing instructions- Returns:
- An ArrayList of preprocessed ArtifactItems
- Throws:
org.apache.maven.plugin.MojoExecutionException
- with a message if an error occurs.- See Also:
ArtifactItem
-
getArtifact
protected org.apache.maven.artifact.Artifact getArtifact(ArtifactItem artifactItem) throws org.apache.maven.plugin.MojoExecutionException
Resolves the Artifact from the remote repository if necessary. If no version is specified, it will be retrieved from the dependency list or from the DependencyManagement section of the pom.- Parameters:
artifactItem
- containing information about artifact from plugin configuration.- Returns:
- Artifact object representing the specified file.
- Throws:
org.apache.maven.plugin.MojoExecutionException
- with a message if the version can't be found in DependencyManagement.
-
getArtifactItems
public List<ArtifactItem> getArtifactItems()
- Returns:
- Returns the artifactItems.
-
setArtifactItems
public void setArtifactItems(List<ArtifactItem> theArtifactItems)
- Parameters:
theArtifactItems
- The artifactItems to set.
-
getOutputDirectory
public File getOutputDirectory()
- Returns:
- Returns the outputDirectory.
-
setOutputDirectory
public void setOutputDirectory(File theOutputDirectory)
- Parameters:
theOutputDirectory
- The outputDirectory to set.
-
isOverWriteIfNewer
public boolean isOverWriteIfNewer()
- Returns:
- Returns the overWriteIfNewer.
-
setOverWriteIfNewer
public void setOverWriteIfNewer(boolean theOverWriteIfNewer)
- Parameters:
theOverWriteIfNewer
- The overWriteIfNewer to set.
-
isOverWriteReleases
public boolean isOverWriteReleases()
- Returns:
- Returns the overWriteReleases.
-
setOverWriteReleases
public void setOverWriteReleases(boolean theOverWriteReleases)
- Parameters:
theOverWriteReleases
- The overWriteReleases to set.
-
isOverWriteSnapshots
public boolean isOverWriteSnapshots()
- Returns:
- Returns the overWriteSnapshots.
-
setOverWriteSnapshots
public void setOverWriteSnapshots(boolean theOverWriteSnapshots)
- Parameters:
theOverWriteSnapshots
- The overWriteSnapshots to set.
-
setLocalRepositoryDirectory
public void setLocalRepositoryDirectory(File localRepositoryDirectory)
- Parameters:
localRepositoryDirectory
-localRepositoryDirectory
-
setArtifact
public void setArtifact(String artifact) throws org.apache.maven.plugin.MojoFailureException
- Parameters:
artifact
- The artifact.- Throws:
org.apache.maven.plugin.MojoFailureException
- in case of an error.
-
-