public class SuperJar
extends java.lang.Object
This class has a main method, and is designed to be invoked from the command line.
Constructor and Description |
---|
SuperJar(java.io.File[] jarFiles,
java.io.File[] flatFiles,
java.lang.String[] jarExcludes,
java.lang.String[] entryExcludes)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args)
Writes a new jar or zip file based on the contents of an existing
jar file and the jar files referenced by its manifest.
|
void |
writeSingleJar(java.io.OutputStream out)
Writes the data from this object to a single jar file combining the
contents of all the dependencies.
|
void |
writeZipOfJars(java.io.OutputStream out)
Writes the data from this object to a zip file containing all the
top-level and dependency jars as individual jar files in the same
directory.
|
public SuperJar(java.io.File[] jarFiles, java.io.File[] flatFiles, java.lang.String[] jarExcludes, java.lang.String[] entryExcludes) throws java.io.IOException
The entryExcludes
values are full pathnames
with no leading "/", interpreted as follows:
jarFiles
- top-level jar files containing files and dependenciesflatFiles
- files for inclusion at top level of outputjarExcludes
- names of jar files which may be named as class-path
dependencies but which should not be included in the resultentryExcludes
- jar file entries which should be excluded
from the resultjava.io.IOException
public void writeSingleJar(java.io.OutputStream out) throws java.io.IOException
out
- destination streamjava.io.IOException
public void writeZipOfJars(java.io.OutputStream out) throws java.io.IOException
out
- destination streamjava.io.IOException
public static void main(java.lang.String[] args) throws java.io.IOException
SuperJar [-oj outjar] [-oz outzip] [[-xjar jar] -xjar jar ...] [[-xentry entry] -xentry entry ...] jarfile [jarfile ...]
If the -oj flag is given, it supplies the name of a monolithic jar file to output. -o is a deprecated synonym for -oj.
If the -oz flag is given, it supplies the name of a zip file to output. This zip file will contain all the named and referenced jar files in a single flat directory.
The -xjar * flag may be supplied one or more times to define jarfiles which should not be included, even if they are referenced in the manifest's Class-Path entry of a jar file which is included. The exclude argument thus defined is the name, optionally with one or more prepended path elements of the jar file to be excluded (e.g. axis.jar or axis/axis.jar would both work). -x is a deprecated synonym for -xjar.
The -xent flag may be supplied one or more times to give full paths for jar entries which should not be included in the output. These are interpreted as follows:
The jarfile argument(s) will be combined to form the output file, all their contents and those of the jar files referenced in their Class-Path manifest entries will be used. The manifest of the first one will be used as the manifest of the output file (though its Class-Path entry will be empty). Zip files can be used as well, they work the same but have no manifest.
Any flat-file arguments will be included as files at the top level of the output jar or zip file.
args
- an array of command-line arguments as described abovejava.io.IOException