Class JarToolModularJarArchiver

  • All Implemented Interfaces:
    Archiver, FinalizerEnabled, org.codehaus.plexus.logging.LogEnabled, org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable

    public class JarToolModularJarArchiver
    extends ModularJarArchiver
    A ModularJarArchiver implementation that uses the jar tool provided by java.util.spi.ToolProvider to create modular JAR files.

    The basic JAR archive is created by JarArchiver and the jar tool is used to upgrade it to modular JAR.

    If the JAR file does not contain module descriptor or the JDK does not provide the jar tool (for example JDK prior to Java 9), then the archive created by JarArchiver is left unchanged.

    • Field Detail

      • MODULE_DESCRIPTOR_FILE_NAME

        private static final java.lang.String MODULE_DESCRIPTOR_FILE_NAME
        See Also:
        Constant Field Values
      • MRJAR_VERSION_AREA

        private static final java.util.regex.Pattern MRJAR_VERSION_AREA
      • jarTool

        private java.lang.Object jarTool
      • moduleDescriptorFound

        private boolean moduleDescriptorFound
    • Constructor Detail

      • JarToolModularJarArchiver

        public JarToolModularJarArchiver()
    • Method Detail

      • zipFile

        protected void zipFile​(org.apache.commons.compress.parallel.InputStreamSupplier is,
                               ConcurrentJarCreator zOut,
                               java.lang.String vPath,
                               long lastModified,
                               java.io.File fromArchive,
                               int mode,
                               java.lang.String symlinkDestination,
                               boolean addInParallel)
                        throws java.io.IOException,
                               ArchiverException
        Description copied from class: JarArchiver
        Overridden from Zip class to deal with manifests and index lists.
        Overrides:
        zipFile in class JarArchiver
        Parameters:
        is - the stream to read data for the entry from.
        zOut - the stream to write to.
        vPath - the name this entry shall have in the archive.
        lastModified - last modification time for the entry.
        fromArchive - the original archive we are copying this
        addInParallel - Indicates if the entry should be add in parallel. If set to false it is added synchronously. If the entry is symbolic link this parameter is ignored.
        Throws:
        java.io.IOException
        ArchiverException
      • isModuleDescriptor

        private boolean isModuleDescriptor​(java.lang.String path)
        Returns true if path is a module descriptor.
      • getJarToolArguments

        private java.lang.String[] getJarToolArguments()
                                                throws java.io.IOException
        Prepares the arguments for the jar tool. It takes into account the module version, main class, etc.
        Throws:
        java.io.IOException