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 AbstractFromConfigurationMojo
Goal that retrieves a list of artifacts from the repository and unpacks them in a defined location.
- Since:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringThe artifact to unpack from command line.private StringA comma separated list of file patterns to exclude when unpacking the artifact.private org.codehaus.plexus.components.io.filemappers.FileMapper[]FileMapperto be used for rewriting each target path, ornullif no rewriting shall happen.private booleanIgnore to set file permissions when unpacking a dependency.private StringA comma separated list of file patterns to include when unpacking the artifact.private FileDirectory to store flag files after unpack.private final UnpackUtilFields inherited from class AbstractDependencyMojo
sessionFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
ConstructorsConstructorDescriptionUnpackMojo(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, UnpackUtil unpackUtil, org.eclipse.aether.RepositorySystem repositorySystem) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidMain entry into mojo.org.codehaus.plexus.components.io.filemappers.FileMapper[](package private) ArtifactItemFilterprotected List<ArtifactItem> getProcessedArtifactItems(boolean removeVersion) voidsetExcludes(String excludes) voidsetFileMappers(org.codehaus.plexus.components.io.filemappers.FileMapper[] fileMappers) voidsetIncludes(String includes) voidsetMarkersDirectory(File theMarkersDirectory) private voidunpackArtifact(ArtifactItem artifactItem) This method gets the Artifact object and calls DependencyUtil.unpackFile.Methods inherited from class AbstractFromConfigurationMojo
getArtifact, getArtifactItems, getOutputDirectory, getProcessedArtifactItems, isOverWriteIfNewer, isOverWriteReleases, isOverWriteSnapshots, setArtifact, setArtifactItems, setLocalRepositoryDirectory, setOutputDirectory, setOverWriteIfNewer, setOverWriteReleases, setOverWriteSnapshots, verifyRequirementsMethods inherited from class AbstractDependencyMojo
execute, getProject, isSilent, isSkip, setSilent, setSkipMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
unpackUtil
-
markersDirectory
@Parameter(property="markersDirectory", defaultValue="${project.build.directory}/dependency-maven-plugin-markers") private File markersDirectoryDirectory to store flag files after unpack. -
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
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[] fileMappersFileMapperto be used for rewriting each target path, ornullif no rewriting shall happen.- Since:
- 3.1.2
-
artifact
The artifact to unpack from command line. A string of the formgroupId:artifactId:version[:packaging[:classifier]]. UseAbstractFromConfigurationMojo.artifactItemswithin the POM configuration.
-
-
Constructor Details
-
UnpackMojo
@Inject public UnpackMojo(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, UnpackUtil unpackUtil, org.eclipse.aether.RepositorySystem repositorySystem)
-
-
Method Details
-
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 occursorg.apache.maven.plugin.MojoFailureException-MojoFailureException- See Also:
-
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:
-
getMarkedArtifactFilter
- Specified by:
getMarkedArtifactFilterin classAbstractFromConfigurationMojo
-
getProcessedArtifactItems
protected 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
- Returns:
- returns the markersDirectory
-
setMarkersDirectory
- Parameters:
theMarkersDirectory- the markersDirectory to set
-
getExcludes
- Returns:
- returns a comma separated list of excluded items
-
setExcludes
- Parameters:
excludes- a comma separated list of items to exclude i.e. **\/*.xml, **\/*.properties
-
getIncludes
- Returns:
- returns a comma separated list of included items
-
setIncludes
- 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
-