Class UnpackMojo
- 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.UnpackMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="unpack", defaultPhase=PROCESS_SOURCES, requiresProject=false, threadSafe=true) public class UnpackMojo extends AbstractFromConfigurationMojoGoal that retrieves a list of artifacts from the repository and unpacks them in a defined location.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringartifactThe artifact to unpack from command line.private java.lang.StringexcludesA comma separated list of file patterns to exclude when unpacking the artifact.private org.codehaus.plexus.components.io.filemappers.FileMapper[]fileMappersFileMapperto be used for rewriting each target path, ornullif no rewriting shall happen.private booleanignorePermissionsignore to set file permissions when unpacking a dependencyprivate java.lang.StringincludesA comma separated list of file patterns to include when unpacking the artifact.private java.io.FilemarkersDirectoryDirectory to store flag files after unpackprivate UnpackUtilunpackUtil-
Fields inherited from class org.apache.maven.plugins.dependency.AbstractDependencyMojo
reactorProjects, session
-
-
Constructor Summary
Constructors Constructor Description UnpackMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoExecute()Main entry into mojo.java.lang.StringgetExcludes()org.codehaus.plexus.components.io.filemappers.FileMapper[]getFileMappers()java.lang.StringgetIncludes()(package private) ArtifactItemFiltergetMarkedArtifactFilter(ArtifactItem item)java.io.FilegetMarkersDirectory()protected java.util.List<ArtifactItem>getProcessedArtifactItems(boolean removeVersion)voidsetExcludes(java.lang.String excludes)voidsetFileMappers(org.codehaus.plexus.components.io.filemappers.FileMapper[] fileMappers)voidsetIncludes(java.lang.String includes)voidsetMarkersDirectory(java.io.File theMarkersDirectory)private voidunpackArtifact(ArtifactItem artifactItem)This method gets the Artifact object and calls DependencyUtil.unpackFile.-
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, newResolveArtifactProjectBuildingRequest, newResolvePluginProjectBuildingRequest, setSilent, setSkip
-
-
-
-
Field Detail
-
unpackUtil
@Component private UnpackUtil unpackUtil
-
markersDirectory
@Parameter(defaultValue="${project.build.directory}/dependency-maven-plugin-markers") private java.io.File markersDirectoryDirectory to store flag files after unpack
-
includes
@Parameter(property="mdep.unpack.includes") private java.lang.String includes
A comma separated list of file patterns to include when unpacking the artifact. i.e.**/*.xml,**/*.propertiesNOTE: Excludes patterns override the includes. (component code =return isIncluded( name ) AND !isExcluded( name );)- Since:
- 2.0-alpha-5
-
excludes
@Parameter(property="mdep.unpack.excludes") private java.lang.String excludes
A comma separated list of file patterns to exclude when unpacking the artifact. i.e. **\/*.xml,**\/*.properties**/*.xml,**/*.propertiesNOTE: Excludes patterns override the includes. (component code =return isIncluded( name ) AND !isExcluded( name );)- Since:
- 2.0-alpha-5
-
ignorePermissions
@Parameter(property="dependency.ignorePermissions", defaultValue="false") private boolean ignorePermissionsignore to set file permissions when unpacking a dependency- Since:
- 2.7
-
fileMappers
@Parameter(property="mdep.unpack.filemappers") private org.codehaus.plexus.components.io.filemappers.FileMapper[] fileMappers
FileMapperto be used for rewriting each target path, ornullif no rewriting shall happen.- Since:
- 3.1.2
-
artifact
@Parameter(property="artifact") private java.lang.String artifact
The artifact to unpack from command line. A string of the formgroupId:artifactId:version[:packaging[:classifier]]. UseAbstractFromConfigurationMojo.artifactItemswithin the POM configuration.
-
-
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 unpackArtifact.- Specified by:
doExecutein classAbstractDependencyMojo- Throws:
org.apache.maven.plugin.MojoExecutionException- with a message if an error occurs.org.apache.maven.plugin.MojoFailureException-MojoFailureException- See Also:
ArtifactItem,AbstractFromConfigurationMojo.getArtifactItems(),unpackArtifact(ArtifactItem)
-
unpackArtifact
private void unpackArtifact(ArtifactItem artifactItem) throws org.apache.maven.plugin.MojoExecutionException
This method gets the Artifact object and calls DependencyUtil.unpackFile.- Parameters:
artifactItem- containing the information about the Artifact to unpack.- Throws:
org.apache.maven.plugin.MojoExecutionException- with a message if an error occurs.- See Also:
AbstractFromConfigurationMojo.getArtifact(org.apache.maven.plugins.dependency.fromConfiguration.ArtifactItem)
-
getMarkedArtifactFilter
ArtifactItemFilter getMarkedArtifactFilter(ArtifactItem item)
- Specified by:
getMarkedArtifactFilterin classAbstractFromConfigurationMojo
-
getProcessedArtifactItems
protected java.util.List<ArtifactItem> getProcessedArtifactItems(boolean removeVersion) throws org.apache.maven.plugin.MojoExecutionException
- Parameters:
removeVersion- removeVersion.- Returns:
- list of
ArtifactItem - Throws:
org.apache.maven.plugin.MojoExecutionException- in case of an error.
-
getMarkersDirectory
public java.io.File getMarkersDirectory()
- Returns:
- Returns the markersDirectory.
-
setMarkersDirectory
public void setMarkersDirectory(java.io.File theMarkersDirectory)
- Parameters:
theMarkersDirectory- The markersDirectory to set.
-
getExcludes
public java.lang.String getExcludes()
- Returns:
- Returns a comma separated list of excluded items
-
setExcludes
public void setExcludes(java.lang.String excludes)
- Parameters:
excludes- A comma separated list of items to exclude i.e. **\/*.xml, **\/*.properties
-
getIncludes
public java.lang.String getIncludes()
- Returns:
- Returns a comma separated list of included items
-
setIncludes
public void setIncludes(java.lang.String includes)
- Parameters:
includes- A comma separated list of items to include i.e. **\/*.xml, **\/*.properties
-
getFileMappers
public org.codehaus.plexus.components.io.filemappers.FileMapper[] getFileMappers()
- Returns:
FileMappers to be used for rewriting each target path, ornullif no rewriting shall happen.- Since:
- 3.1.2
-
setFileMappers
public void setFileMappers(org.codehaus.plexus.components.io.filemappers.FileMapper[] fileMappers)
- Parameters:
fileMappers-FileMappers to be used for rewriting each target path, ornullif no rewriting shall happen.- Since:
- 3.1.2
-
-