类 Repackager


  • public class Repackager
    extends Object
    Utility class that can be used to repackage an archive so that it can be executed using 'java -jar'.
    • 方法详细资料

      • setMainClass

        public void setMainClass​(String mainClass)
        Sets the main class that should be run. If not specified the value from the MANIFEST will be used, or if no manifest entry is found the archive will be searched for a suitable class.
        参数:
        mainClass - the main class name
      • setBackupSource

        public void setBackupSource​(boolean backupSource)
        Sets if source files should be backed up when they would be overwritten.
        参数:
        backupSource - if source files should be backed up
      • setLayoutFactory

        public void setLayoutFactory​(LayoutFactory layoutFactory)
        Sets the layout factory for the jar. The factory can be used when no specific layout is specified.
        参数:
        layoutFactory - the layout factory to set
      • repackage

        public void repackage​(Libraries libraries)
                       throws IOException
        Repackage the source file so that it can be run using 'java -jar'.
        参数:
        libraries - the libraries required to run the archive
        抛出:
        IOException - if the file cannot be repackaged
      • repackage

        public void repackage​(File destination,
                              Libraries libraries)
                       throws IOException
        Repackage to the given destination so that it can be launched using ' java -jar'.
        参数:
        destination - the destination file (may be the same as the source)
        libraries - the libraries required to run the archive
        抛出:
        IOException - if the file cannot be repackaged
      • repackage

        public void repackage​(File destination,
                              Libraries libraries,
                              LaunchScript launchScript)
                       throws IOException
        Repackage to the given destination so that it can be launched using ' java -jar'.
        参数:
        destination - the destination file (may be the same as the source)
        libraries - the libraries required to run the archive
        launchScript - an optional launch script prepended to the front of the jar
        抛出:
        IOException - if the file cannot be repackaged
        从以下版本开始:
        1.3.0
      • getBackupFile

        public final File getBackupFile()
        Return the File to use to backup the original source.
        返回:
        the file to use to backup the original source