public abstract class Packager extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
Packager.MainClassTimeoutWarningListener
Callback interface used to present a warning when finding the main class takes too
long.
|
Modifier | Constructor and Description |
---|---|
protected |
Packager(File source,
LayoutFactory layoutFactory)
Create a new
Packager instance. |
Modifier and Type | Method and Description |
---|---|
void |
addMainClassTimeoutWarningListener(Packager.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. |
protected Layout |
getLayout() |
protected File |
getSource() |
protected boolean |
isAlreadyPackaged() |
protected boolean |
isAlreadyPackaged(File file) |
void |
setIncludeRelevantJarModeJars(boolean includeRelevantJarModeJars)
Sets if jarmode jars relevant for the packaging should be automatcially included.
|
void |
setLayers(Layers layers)
Sets the layers that should be used in the jar.
|
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.
|
protected void |
write(JarFile sourceJar,
Libraries libraries,
AbstractJarWriter writer) |
protected Packager(File source, LayoutFactory layoutFactory)
Packager
instance.source
- the source JAR file to packagelayoutFactory
- the layout factory to use or null
public void addMainClassTimeoutWarningListener(Packager.MainClassTimeoutWarningListener listener)
listener
- the listener to addpublic void setMainClass(String mainClass)
mainClass
- the main class namepublic void setLayout(Layout layout)
Layouts.forFile(File)
.layout
- the layoutpublic void setLayoutFactory(LayoutFactory layoutFactory)
layoutFactory
- the layout factory to setpublic void setLayers(Layers layers)
layers
- the jar layersLayeredLayout
public void setIncludeRelevantJarModeJars(boolean includeRelevantJarModeJars)
includeRelevantJarModeJars
- if relevant jars are includedprotected final boolean isAlreadyPackaged() throws IOException
IOException
protected final boolean isAlreadyPackaged(File file) throws IOException
IOException
protected final void write(JarFile sourceJar, Libraries libraries, AbstractJarWriter writer) throws IOException
IOException
protected String findMainMethod(JarFile source) throws IOException
IOException
public final File getBackupFile()
File
to use to backup the original source.protected final File getSource()
protected final Layout getLayout()