public class Repackager extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
Repackager.MainClassTimeoutWarningListener
Callback interface used to present a warning when finding the main class takes too
long.
|
Constructor and Description |
---|
Repackager(File source) |
Repackager(File source,
LayoutFactory layoutFactory) |
Modifier and Type | Method and Description |
---|---|
void |
addMainClassTimeoutWarningListener(Repackager.MainClassTimeoutWarningListener listener)
Add a listener that will be triggered to display a warning if searching for the
main class takes too long.
|
protected String |
findMainMethod(JarFile source) |
File |
getBackupFile()
Return the
File to use to backup the original source. |
void |
repackage(File destination,
Libraries libraries)
Repackage to the given destination so that it can be launched using '
java -jar'.
|
void |
repackage(File destination,
Libraries libraries,
LaunchScript launchScript)
Repackage to the given destination so that it can be launched using '
java -jar'.
|
void |
repackage(Libraries libraries)
Repackage the source file so that it can be run using 'java -jar'.
|
void |
setBackupSource(boolean backupSource)
Sets if source files should be backed up when they would be overwritten.
|
void |
setLayout(Layout layout)
Sets the layout to use for the jar.
|
void |
setLayoutFactory(LayoutFactory layoutFactory)
Sets the layout factory for the jar.
|
void |
setMainClass(String mainClass)
Sets the main class that should be run.
|
public Repackager(File source)
public Repackager(File source, LayoutFactory layoutFactory)
public void addMainClassTimeoutWarningListener(Repackager.MainClassTimeoutWarningListener listener)
listener
- the listener to addpublic void setMainClass(String mainClass)
mainClass
- the main class namepublic void setBackupSource(boolean backupSource)
backupSource
- if source files should be backed uppublic void setLayout(Layout layout)
Layouts.forFile(File)
.layout
- the layoutpublic void setLayoutFactory(LayoutFactory layoutFactory)
layoutFactory
- the layout factory to setpublic void repackage(Libraries libraries) throws IOException
libraries
- the libraries required to run the archiveIOException
- if the file cannot be repackagedpublic void repackage(File destination, Libraries libraries) throws IOException
destination
- the destination file (may be the same as the source)libraries
- the libraries required to run the archiveIOException
- if the file cannot be repackagedpublic void repackage(File destination, Libraries libraries, LaunchScript launchScript) throws IOException
destination
- the destination file (may be the same as the source)libraries
- the libraries required to run the archivelaunchScript
- an optional launch script prepended to the front of the jarIOException
- if the file cannot be repackagedpublic final File getBackupFile()
File
to use to backup the original source.protected String findMainMethod(JarFile source) throws IOException
IOException
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.