Class DefaultAssemblyArchiver

  • All Implemented Interfaces:
    AssemblyArchiver

    @Named
    public class DefaultAssemblyArchiver
    extends java.lang.Object
    implements AssemblyArchiver
    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 Detail

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • archiverManager

        private final org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager
      • containerDescriptorHandlers

        private final java.util.Map<java.lang.String,​ContainerDescriptorHandler> containerDescriptorHandlers
      • container

        private final org.codehaus.plexus.PlexusContainer container
    • Constructor Detail

      • DefaultAssemblyArchiver

        @Inject
        public DefaultAssemblyArchiver​(org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager,
                                       java.util.List<AssemblyArchiverPhase> assemblyPhases,
                                       java.util.Map<java.lang.String,​ContainerDescriptorHandler> containerDescriptorHandlers,
                                       org.codehaus.plexus.PlexusContainer container)
    • Method Detail

      • createArchive

        public java.io.File createArchive​(Assembly assembly,
                                          java.lang.String fullName,
                                          java.lang.String format,
                                          AssemblerConfigurationSource configSource,
                                          boolean recompressZippedFiles,
                                          java.lang.String mergeManifestMode,
                                          java.nio.file.attribute.FileTime outputTimestamp)
                                   throws ArchiveCreationException,
                                          AssemblyFormattingException,
                                          InvalidAssemblerConfigurationException
        Create the assembly archive. Generally:
        1. Setup any directory structures for temporary files
        2. Calculate the output directory/file for the assembly
        3. Setup any handler components for special descriptor files we may encounter
        4. Lookup and configure the Archiver to be used
        5. 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.
        6. 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 interface AssemblyArchiver
        Parameters:
        assembly - The Assembly
        fullName - The full name.
        format - The format.
        configSource - The AssemblerConfigurationSource
        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 fails
        AssemblyFormattingException - when formatting fails
        InvalidAssemblerConfigurationException - when the configuration is bad
      • createArchiver

        protected org.codehaus.plexus.archiver.Archiver createArchiver​(java.lang.String format,
                                                                       boolean includeBaseDir,
                                                                       java.lang.String finalName,
                                                                       AssemblerConfigurationSource configSource,
                                                                       java.util.List<ContainerDescriptorHandler> containerHandlers,
                                                                       boolean recompressZippedFiles,
                                                                       java.lang.String mergeManifestMode,
                                                                       java.nio.file.attribute.FileTime outputTimestamp)
                                                                throws org.codehaus.plexus.archiver.manager.NoSuchArchiverException
        Creates the necessary archiver to build the distribution file.
        Parameters:
        format - Archive format
        includeBaseDir - the base directory for include.
        finalName - The final name.
        configSource - AssemblerConfigurationSource
        containerHandlers - The list of ContainerDescriptorHandler
        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
      • configureJarArchiver

        private void configureJarArchiver​(org.codehaus.plexus.archiver.jar.JarArchiver archiver,
                                          java.lang.String mergeManifestMode)
      • configureArchiver

        private void configureArchiver​(org.codehaus.plexus.archiver.Archiver archiver,
                                       AssemblerConfigurationSource configSource)
      • configureComponent

        private void configureComponent​(java.lang.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

        private java.lang.Object[] getContainerRealm()
      • createTarZstArchiver

        protected org.codehaus.plexus.archiver.Archiver createTarZstArchiver()
                                                                      throws org.codehaus.plexus.archiver.manager.NoSuchArchiverException
        Throws:
        org.codehaus.plexus.archiver.manager.NoSuchArchiverException