Class DefaultAssemblyArchiver
java.lang.Object
org.codehaus.plexus.logging.AbstractLogEnabled
org.apache.maven.plugins.assembly.archive.DefaultAssemblyArchiver
- All Implemented Interfaces:
AssemblyArchiver
,org.codehaus.plexus.logging.LogEnabled
,org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
@Component(role=AssemblyArchiver.class,
instantiationStrategy="per-lookup")
public class DefaultAssemblyArchiver
extends org.codehaus.plexus.logging.AbstractLogEnabled
implements AssemblyArchiver, org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
Controller component designed to organize the many activities involved in creating an assembly archive. This includes
locating and configuring
Archiver
instances, executing multiple .archive.phase.AssemblyArchiverPhase
instances to
interpret the various sections of the assembly descriptor and determine which files to add, and other associated
activities.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.codehaus.plexus.archiver.manager.ArchiverManager
private List<AssemblyArchiverPhase>
private org.codehaus.plexus.PlexusContainer
private Map<String,
ContainerDescriptorHandler> Fields inherited from interface org.apache.maven.plugins.assembly.archive.AssemblyArchiver
ROLE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
DefaultAssemblyArchiver
(org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager, List<AssemblyArchiverPhase> assemblyPhases) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
configureArchiver
(org.codehaus.plexus.archiver.Archiver archiver, AssemblerConfigurationSource configSource) private void
configureComponent
(Object component, org.codehaus.plexus.util.xml.Xpp3Dom config, AssemblerConfigurationSource configSource) private void
configureContainerDescriptorHandler
(ContainerDescriptorHandler handler, org.codehaus.plexus.util.xml.Xpp3Dom config, AssemblerConfigurationSource configSource) void
contextualize
(org.codehaus.plexus.context.Context context) createArchive
(Assembly assembly, String fullName, String format, AssemblerConfigurationSource configSource, boolean recompressZippedFiles, String mergeManifestMode, Date outputTimestamp) Create the assembly archive.protected org.codehaus.plexus.archiver.Archiver
createArchiver
(String format, boolean includeBaseDir, String finalName, AssemblerConfigurationSource configSource, List<ContainerDescriptorHandler> containerHandlers, boolean recompressZippedFiles, String mergeManifestMode, Date outputTimestamp) Creates the necessary archiver to build the distribution file.protected org.codehaus.plexus.archiver.Archiver
createTarArchiver
(String format, org.codehaus.plexus.archiver.tar.TarLongFileMode tarLongFileMode) protected org.codehaus.plexus.archiver.Archiver
private Object[]
private List<ContainerDescriptorHandler>
selectContainerDescriptorHandlers
(List<ContainerDescriptorHandlerConfig> requestedContainerDescriptorHandlers, AssemblerConfigurationSource configSource) protected void
setContainer
(org.codehaus.plexus.PlexusContainer container) private List<AssemblyArchiverPhase>
private void
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
archiverManager
@Requirement private org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager -
assemblyPhases
-
containerDescriptorHandlers
@Requirement(role=ContainerDescriptorHandler.class) private Map<String,ContainerDescriptorHandler> containerDescriptorHandlers -
container
private org.codehaus.plexus.PlexusContainer container
-
-
Constructor Details
-
DefaultAssemblyArchiver
public DefaultAssemblyArchiver() -
DefaultAssemblyArchiver
protected DefaultAssemblyArchiver(org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager, List<AssemblyArchiverPhase> assemblyPhases) - Parameters:
archiverManager
- The archive manager.assemblyPhases
- The list ofAssemblyArchiverPhase
-
-
Method Details
-
sortedPhases
-
createArchive
public File createArchive(Assembly assembly, String fullName, String format, AssemblerConfigurationSource configSource, boolean recompressZippedFiles, String mergeManifestMode, Date outputTimestamp) throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException Create the assembly archive. Generally:- Setup any directory structures for temporary files
- Calculate the output directory/file for the assembly
- Setup any handler components for special descriptor files we may encounter
- Lookup and configure the
Archiver
to be used - Determine what, if any, dependency resolution will be required, and resolve any dependency-version conflicts up front to produce a managed-version map for the whole assembly process.
- Iterate through the available
AssemblyArchiverPhase
instances, executing each to handle a different top-level section of the assembly descriptor, if that section is present.
- Specified by:
createArchive
in interfaceAssemblyArchiver
- Parameters:
assembly
- TheAssembly
fullName
- The full name.format
- The format.configSource
- TheAssemblerConfigurationSource
recompressZippedFiles
- recompress zipped files.mergeManifestMode
- How to handle already existing Manifest files (skip, merge, mergewithoutmain)outputTimestamp
- Timestamp for reproducible archive entries- Returns:
- The resulting archive file.
- Throws:
ArchiveCreationException
- when creation failsAssemblyFormattingException
- when formatting failsInvalidAssemblerConfigurationException
- when the configuration is bad
-
validate
-
selectContainerDescriptorHandlers
private List<ContainerDescriptorHandler> selectContainerDescriptorHandlers(List<ContainerDescriptorHandlerConfig> requestedContainerDescriptorHandlers, AssemblerConfigurationSource configSource) throws InvalidAssemblerConfigurationException -
createArchiver
protected org.codehaus.plexus.archiver.Archiver createArchiver(String format, boolean includeBaseDir, String finalName, AssemblerConfigurationSource configSource, List<ContainerDescriptorHandler> containerHandlers, boolean recompressZippedFiles, String mergeManifestMode, Date outputTimestamp) throws org.codehaus.plexus.archiver.manager.NoSuchArchiverException Creates the necessary archiver to build the distribution file.- Parameters:
format
- Archive formatincludeBaseDir
- the base directory for include.finalName
- The final name.configSource
-AssemblerConfigurationSource
containerHandlers
- The list ofContainerDescriptorHandler
recompressZippedFiles
- recompress zipped files.mergeManifestMode
- how to handle already existing Manifest files- Returns:
- archiver Archiver generated
- Throws:
org.codehaus.plexus.archiver.ArchiverException
org.codehaus.plexus.archiver.manager.NoSuchArchiverException
-
configureContainerDescriptorHandler
private void configureContainerDescriptorHandler(ContainerDescriptorHandler handler, org.codehaus.plexus.util.xml.Xpp3Dom config, AssemblerConfigurationSource configSource) throws InvalidAssemblerConfigurationException -
configureArchiver
private void configureArchiver(org.codehaus.plexus.archiver.Archiver archiver, AssemblerConfigurationSource configSource) -
configureComponent
private void configureComponent(Object component, org.codehaus.plexus.util.xml.Xpp3Dom config, AssemblerConfigurationSource configSource) throws org.codehaus.plexus.component.repository.exception.ComponentLookupException, org.codehaus.plexus.component.configurator.ComponentConfigurationException - Throws:
org.codehaus.plexus.component.repository.exception.ComponentLookupException
org.codehaus.plexus.component.configurator.ComponentConfigurationException
-
getContainerRealm
-
createWarArchiver
protected org.codehaus.plexus.archiver.Archiver createWarArchiver() throws org.codehaus.plexus.archiver.manager.NoSuchArchiverException- Throws:
org.codehaus.plexus.archiver.manager.NoSuchArchiverException
-
createTarArchiver
protected org.codehaus.plexus.archiver.Archiver createTarArchiver(String format, org.codehaus.plexus.archiver.tar.TarLongFileMode tarLongFileMode) throws org.codehaus.plexus.archiver.manager.NoSuchArchiverException - Throws:
org.codehaus.plexus.archiver.manager.NoSuchArchiverException
-
contextualize
public void contextualize(org.codehaus.plexus.context.Context context) throws org.codehaus.plexus.context.ContextException - Specified by:
contextualize
in interfaceorg.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
- Throws:
org.codehaus.plexus.context.ContextException
-
setContainer
protected void setContainer(org.codehaus.plexus.PlexusContainer container)
-