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)
Create a new
Packager instance. |
protected |
Packager(File source,
LayoutFactory layoutFactory)
Deprecated.
since 2.3.10 for removal in 2.5 in favor of
Packager(File) and
setLayoutFactory(LayoutFactory) |
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 back up the original source. |
protected Layout |
getLayout() |
protected File |
getSource() |
protected boolean |
isAlreadyPackaged() |
protected boolean |
isAlreadyPackaged(File file) |
protected void |
setBackupFile(File backupFile)
Sets the
File to use to back up the original source. |
void |
setIncludeRelevantJarModeJars(boolean includeRelevantJarModeJars)
Sets if jarmode jars relevant for the packaging should be automatically 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 void |
write(JarFile sourceJar,
Libraries libraries,
AbstractJarWriter writer,
boolean ensureReproducibleBuild) |
protected Packager(File source)
Packager
instance.source
- the source archive file to package@Deprecated protected Packager(File source, LayoutFactory layoutFactory)
Packager(File)
and
setLayoutFactory(LayoutFactory)
Packager
instance.source
- the source archive 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 layersprotected void setBackupFile(File backupFile)
File
to use to back up the original source.backupFile
- the file to use to back up the original sourcepublic void setIncludeRelevantJarModeJars(boolean includeRelevantJarModeJars)
includeRelevantJarModeJars
- if relevant jars are includedprotected final boolean isAlreadyPackaged()
protected final boolean isAlreadyPackaged(File file)
protected final void write(JarFile sourceJar, Libraries libraries, AbstractJarWriter writer) throws IOException
IOException
protected final void write(JarFile sourceJar, Libraries libraries, AbstractJarWriter writer, boolean ensureReproducibleBuild) throws IOException
IOException
protected String findMainMethod(JarFile source) throws IOException
IOException
public final File getBackupFile()
File
to use to back up the original source.protected final File getSource()
protected final Layout getLayout()