@ -11,6 +11,8 @@ an application's dependencies and can then be run with `java -jar`.
@@ -11,6 +11,8 @@ an application's dependencies and can then be run with `java -jar`.
Executable jars can be built using the `bootJar` task. The task is automatically created
when the `java` plugin is applied and is an instance of {boot-jar-javadoc}[`BootJar`].
The `assemble` task is automatically configured to depend upon the `bootJar` task so
running `assemble` (or `build`) will also run the `bootJar` task.
@ -19,6 +21,8 @@ when the `java` plugin is applied and is an instance of {boot-jar-javadoc}[`Boot
@@ -19,6 +21,8 @@ when the `java` plugin is applied and is an instance of {boot-jar-javadoc}[`Boot
Executable wars can be built using the `bootWar` task. The task is automatically created
when the `war` plugin is applied and is an instance of {boot-war-javadoc}[`BootWar`].
The `assemble` task is automatically configured to depend upon the `bootWar` task so
running `assemble` (or `build`) will also run the `bootWar` task.
@ -43,6 +47,27 @@ web-based integration tests will fail.
@@ -43,6 +47,27 @@ web-based integration tests will fail.
[[packaging-executable-and-normal]]
=== Packaging executable and normal archives
By default, when the `bootJar` or `bootWar` tasks are configured, the `jar` or `war`
tasks are disabled. A project can be configured to build both an executable archive
and a normal archive at the same time by enabling the `jar` or `war` task:
executable, fat jar for the project. The jar will contain everything on the runtime
classpath of the main source set; classes are packaged in `BOOT-INF/classes` and jars
are packaged in `BOOT-INF/lib`
2. Creates a {software-component}[software component] named `bootJava` that contains the
2. Configures the `assemble` task to depend on the `bootJar` task.
3. Disables the `jar` task.
4. Creates a {software-component}[software component] named `bootJava` that contains the
archive produced by the `bootJar` task.
3. Creates a {boot-run-javadoc}[`BootRun`] task named `bootRun` that can be used to run
5. Creates a {boot-run-javadoc}[`BootRun`] task named `bootRun` that can be used to run
your application.
4. Creates a configuration named `bootArchives` that contains the artifact produced by
6. Creates a configuration named `bootArchives` that contains the artifact produced by
the `bootJar` task.
5. Configures any `JavaCompile` tasks with no configured encoding to use `UTF-8`.
7. Configures any `JavaCompile` tasks with no configured encoding to use `UTF-8`.
@ -32,9 +34,11 @@ When Gradle's {war-plugin}[`war` plugin] is applied to a project, the Spring Boo
@@ -32,9 +34,11 @@ When Gradle's {war-plugin}[`war` plugin] is applied to a project, the Spring Boo
1. Creates a {boot-war-javadoc}[`BootWar`] task named `bootWar` that will create an
executable, fat war for the project. In addition to the standard packaging, everything
in the `providedRuntime` configuration will be packaged in `WEB-INF/lib-provided`.
2. Creates a {software-component}[software component] named `bootWeb` that contains the
2. Configures the `assemble` task to depend on the `bootWar` task.
3. Disables the `war` task.
4. Creates a {software-component}[software component] named `bootWeb` that contains the
archive produced by the `bootWar` task.
3. Configures the `bootArchives` configuration to contain the artifact produced by the
5. Configures the `bootArchives` configuration to contain the artifact produced by the
@ -52,12 +53,23 @@ final class JavaPluginAction implements PluginApplicationAction {
@@ -52,12 +53,23 @@ final class JavaPluginAction implements PluginApplicationAction {