|
|
@ -113,9 +113,9 @@ shown in the following example:
|
|
|
|
0063 3452 3980
|
|
|
|
0063 3452 3980
|
|
|
|
----
|
|
|
|
----
|
|
|
|
|
|
|
|
|
|
|
|
The preceding example shows how `A.class` can be found in `/BOOT-INF/classes` in `myapp.jar`
|
|
|
|
The preceding example shows how `A.class` can be found in `/BOOT-INF/classes` in
|
|
|
|
at position `0063`. `B.class` from the nested jar can actually be found in `myapp.jar`
|
|
|
|
`myapp.jar` at position `0063`. `B.class` from the nested jar can actually be found in
|
|
|
|
at position `3452`, and `C.class` is at position `3980`.
|
|
|
|
`myapp.jar` at position `3452`, and `C.class` is at position `3980`.
|
|
|
|
|
|
|
|
|
|
|
|
Armed with this information, we can load specific nested entries by seeking to
|
|
|
|
Armed with this information, we can load specific nested entries by seeking to
|
|
|
|
the appropriate part of the outer jar. We do not need to unpack the archive, and we
|
|
|
|
the appropriate part of the outer jar. We do not need to unpack the archive, and we
|
|
|
@ -140,16 +140,16 @@ is used as an executable jar's main entry point. It is the actual `Main-Class` i
|
|
|
|
file, and it is used to setup an appropriate `URLClassLoader` and ultimately call your
|
|
|
|
file, and it is used to setup an appropriate `URLClassLoader` and ultimately call your
|
|
|
|
`main()` method.
|
|
|
|
`main()` method.
|
|
|
|
|
|
|
|
|
|
|
|
There are three launcher subclasses (`JarLauncher`, `WarLauncher`, and `PropertiesLauncher`).
|
|
|
|
There are three launcher subclasses (`JarLauncher`, `WarLauncher`, and
|
|
|
|
Their purpose is to load resources (`.class` files and so on.) from nested jar files or war
|
|
|
|
`PropertiesLauncher`). Their purpose is to load resources (`.class` files and so on.) from
|
|
|
|
files in directories (as opposed to those explicitly on the classpath). In the case of
|
|
|
|
nested jar files or war files in directories (as opposed to those explicitly on the
|
|
|
|
`JarLauncher` and `WarLauncher`, the nested paths are fixed. `JarLauncher` looks in
|
|
|
|
classpath). In the case of `JarLauncher` and `WarLauncher`, the nested paths are fixed.
|
|
|
|
`BOOT-INF/lib/`, and `WarLauncher` looks in `WEB-INF/lib/` and `WEB-INF/lib-provided/`.
|
|
|
|
`JarLauncher` looks in `BOOT-INF/lib/`, and `WarLauncher` looks in `WEB-INF/lib/` and
|
|
|
|
You can add extra jars in those locations if you want more. The `PropertiesLauncher`
|
|
|
|
`WEB-INF/lib-provided/`. You can add extra jars in those locations if you want more. The
|
|
|
|
looks in `BOOT-INF/lib/` in your application archive by default, but you can add
|
|
|
|
`PropertiesLauncher` looks in `BOOT-INF/lib/` in your application archive by default, but
|
|
|
|
additional locations by setting an environment variable called `LOADER_PATH` or `loader.path`
|
|
|
|
you can add additional locations by setting an environment variable called `LOADER_PATH`
|
|
|
|
in `loader.properties` (which is a comma-separated list of directories, archives, or directories
|
|
|
|
or `loader.path` in `loader.properties` (which is a comma-separated list of directories,
|
|
|
|
within archives).
|
|
|
|
archives, or directories within archives).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -206,12 +206,12 @@ properties (System properties, environment variables, manifest entries, or
|
|
|
|
|Key |Purpose
|
|
|
|
|Key |Purpose
|
|
|
|
|
|
|
|
|
|
|
|
|`loader.path`
|
|
|
|
|`loader.path`
|
|
|
|
|Comma-separated Classpath, such as `lib,${HOME}/app/lib`. Earlier entries take precedence,
|
|
|
|
|Comma-separated Classpath, such as `lib,${HOME}/app/lib`. Earlier entries take
|
|
|
|
like a regular `-classpath` on the `javac` command line.
|
|
|
|
precedence, like a regular `-classpath` on the `javac` command line.
|
|
|
|
|
|
|
|
|
|
|
|
|`loader.home`
|
|
|
|
|`loader.home`
|
|
|
|
|Used to resolve relative paths in `loader.path`. For example, given `loader.path=lib`, then
|
|
|
|
|Used to resolve relative paths in `loader.path`. For example, given `loader.path=lib`,
|
|
|
|
`${loader.home}/lib` is a classpath location (along with all jar files in that
|
|
|
|
then `${loader.home}/lib` is a classpath location (along with all jar files in that
|
|
|
|
directory). This property is also used to locate a `loader.properties` file, as in the
|
|
|
|
directory). This property is also used to locate a `loader.properties` file, as in the
|
|
|
|
following example `file:///opt/app`
|
|
|
|
following example `file:///opt/app`
|
|
|
|
It defaults to `${user.dir}`.
|
|
|
|
It defaults to `${user.dir}`.
|
|
|
@ -278,14 +278,14 @@ The following rules apply to working with `PropertiesLauncher`:
|
|
|
|
with that name exists is used.
|
|
|
|
with that name exists is used.
|
|
|
|
* `loader.home` is the directory location of an additional properties file
|
|
|
|
* `loader.home` is the directory location of an additional properties file
|
|
|
|
(overriding the default) only when `loader.config.location` is not specified.
|
|
|
|
(overriding the default) only when `loader.config.location` is not specified.
|
|
|
|
* `loader.path` can contain directories (which are scanned recursively for jar and zip files),
|
|
|
|
* `loader.path` can contain directories (which are scanned recursively for jar and zip
|
|
|
|
archive paths, a directory within an archive that is scanned for jar files (for
|
|
|
|
files), archive paths, a directory within an archive that is scanned for jar files (for
|
|
|
|
example, `dependencies.jar!/lib`), or wildcard patterns (for the default JVM behavior).
|
|
|
|
example, `dependencies.jar!/lib`), or wildcard patterns (for the default JVM behavior).
|
|
|
|
Archive paths can be relative to `loader.home` or anywhere in the file system with a
|
|
|
|
Archive paths can be relative to `loader.home` or anywhere in the file system with a
|
|
|
|
`jar:file:` prefix.
|
|
|
|
`jar:file:` prefix.
|
|
|
|
* `loader.path` (if empty) defaults to `BOOT-INF/lib` (meaning a local directory or a
|
|
|
|
* `loader.path` (if empty) defaults to `BOOT-INF/lib` (meaning a local directory or a
|
|
|
|
nested one if running from an archive). Because of this, `PropertiesLauncher` behaves the
|
|
|
|
nested one if running from an archive). Because of this, `PropertiesLauncher` behaves
|
|
|
|
same as `JarLauncher` when no additional configuration is provided.
|
|
|
|
the same as `JarLauncher` when no additional configuration is provided.
|
|
|
|
* `loader.path` can not be used to configure the location of `loader.properties` (the
|
|
|
|
* `loader.path` can not be used to configure the location of `loader.properties` (the
|
|
|
|
classpath used to search for the latter is the JVM classpath when `PropertiesLauncher`
|
|
|
|
classpath used to search for the latter is the JVM classpath when `PropertiesLauncher`
|
|
|
|
is launched).
|
|
|
|
is launched).
|
|
|
@ -325,8 +325,8 @@ consider a different logging implementation.
|
|
|
|
|
|
|
|
|
|
|
|
[[executable-jar-alternatives]]
|
|
|
|
[[executable-jar-alternatives]]
|
|
|
|
=== Alternative Single Jar Solutions
|
|
|
|
=== Alternative Single Jar Solutions
|
|
|
|
If the preceding restrictions mean that you cannot use Spring Boot Loader, consider the following
|
|
|
|
If the preceding restrictions mean that you cannot use Spring Boot Loader, consider the
|
|
|
|
alternatives:
|
|
|
|
following alternatives:
|
|
|
|
|
|
|
|
|
|
|
|
* http://maven.apache.org/plugins/maven-shade-plugin/[Maven Shade Plugin]
|
|
|
|
* http://maven.apache.org/plugins/maven-shade-plugin/[Maven Shade Plugin]
|
|
|
|
* http://www.jdotsoft.com/JarClassLoader.php[JarClassLoader]
|
|
|
|
* http://www.jdotsoft.com/JarClassLoader.php[JarClassLoader]
|
|
|
|