2017-03-15 04:51:23 +08:00
|
|
|
[[reacting-to-other-plugins]]
|
|
|
|
|
== Reacting to other plugins
|
|
|
|
|
|
|
|
|
|
When another plugin is applied the Spring Boot plugin reacts by making various changes
|
|
|
|
|
to the project's configuration. This section describes those changes.
|
|
|
|
|
|
2018-01-29 18:13:12 +08:00
|
|
|
|
|
|
|
|
|
2017-03-15 04:51:23 +08:00
|
|
|
[[reacting-to-other-plugins-java]]
|
|
|
|
|
=== Reacting to the Java plugin
|
|
|
|
|
|
|
|
|
|
When Gradle's {java-plugin}[`java` plugin] is applied to a project, the Spring Boot
|
|
|
|
|
plugin:
|
|
|
|
|
|
|
|
|
|
1. Creates a {boot-jar-javadoc}[`BootJar`] task named `bootJar` that will create an
|
|
|
|
|
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`
|
2017-04-28 23:48:48 +08:00
|
|
|
2. Configures the `assemble` task to depend on the `bootJar` task.
|
|
|
|
|
3. Disables the `jar` task.
|
2017-05-31 21:14:55 +08:00
|
|
|
4. Creates a {boot-run-javadoc}[`BootRun`] task named `bootRun` that can be used to run
|
2017-03-15 04:51:23 +08:00
|
|
|
your application.
|
2017-05-31 21:14:55 +08:00
|
|
|
5. Creates a configuration named `bootArchives` that contains the artifact produced by
|
2017-03-15 04:51:23 +08:00
|
|
|
the `bootJar` task.
|
2017-05-31 21:14:55 +08:00
|
|
|
6. Configures any `JavaCompile` tasks with no configured encoding to use `UTF-8`.
|
2017-09-20 19:29:25 +08:00
|
|
|
7. Configures any `JavaCompile` tasks to use the `-parameters` compiler argument.
|
2017-03-15 04:51:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-01-29 18:13:12 +08:00
|
|
|
[[reacting-to-other-plugins-kotlin]]
|
|
|
|
|
=== Reacting to the Kotlin plugin
|
|
|
|
|
|
|
|
|
|
When {kotlin-plugin}[Kotlin's Gradle plugin] is applied to a project, the Spring Boot
|
|
|
|
|
plugin:
|
|
|
|
|
|
2018-02-01 02:05:20 +08:00
|
|
|
1. Aligns the Kotlin version used in Spring Boot's dependency management with the version
|
2018-01-29 18:13:12 +08:00
|
|
|
of the plugin. This is achieved by setting the `kotlin.version` property with a value
|
|
|
|
|
that matches the version of the Kotlin plugin.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-15 04:51:23 +08:00
|
|
|
[[reacting-to-other-plugins-war]]
|
|
|
|
|
=== Reacting to the war plugin
|
|
|
|
|
|
|
|
|
|
When Gradle's {war-plugin}[`war` plugin] is applied to a project, the Spring Boot plugin:
|
|
|
|
|
|
|
|
|
|
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`.
|
2017-04-28 23:48:48 +08:00
|
|
|
2. Configures the `assemble` task to depend on the `bootWar` task.
|
|
|
|
|
3. Disables the `war` task.
|
2017-05-31 21:14:55 +08:00
|
|
|
4. Configures the `bootArchives` configuration to contain the artifact produced by the
|
2017-03-15 04:51:23 +08:00
|
|
|
`bootWar` task.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[[reacting-to-other-plugins-dependency-management]]
|
|
|
|
|
=== Reacting to the dependency management plugin
|
|
|
|
|
|
|
|
|
|
When the {dependency-management-plugin}[`io.spring.dependency-management` plugin] is
|
|
|
|
|
applied to a project, the Spring Boot plugin will automatically import the
|
|
|
|
|
`spring-boot-dependencies` bom.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[[reacting-to-other-plugins-application]]
|
|
|
|
|
=== Reacting to the application plugin
|
|
|
|
|
|
|
|
|
|
When Gradle's {application-plugin}[`application` plugin] is applied to a project, the
|
|
|
|
|
Spring Boot plugin:
|
|
|
|
|
|
|
|
|
|
1. Creates a `CreateStartScripts` task named `bootStartScripts` that will creates scripts
|
|
|
|
|
that launch the artifact in the `bootArchives` configuration using `java -jar`.
|
|
|
|
|
2. Creates a new distribution named `boot` and configures it to contain the artifact in
|
|
|
|
|
the `bootArchives` configuration in its `lib` directory and the start scripts in its
|
|
|
|
|
`bin` directory.
|
|
|
|
|
3. Configures the `bootRun` task to use the `mainClassName` property as a convention for
|
|
|
|
|
its `main` property.
|
|
|
|
|
4. Configures the `bootRun` task to use the `applicationDefaultJvmArgs` property as a
|
|
|
|
|
convention for its `jvmArgs` property.
|
|
|
|
|
5. Configures the `bootJar` task to use the `mainClassName` property as a convention for
|
|
|
|
|
the `Start-Class` entry in its manifest.
|
|
|
|
|
6. Configures the `bootWar` task to use the `mainClassName` property as a convention for
|
|
|
|
|
the `Start-Class` entry in its manifest.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[[reacting-to-other-plugins-maven]]
|
|
|
|
|
=== Reacting to the Maven plugin
|
|
|
|
|
|
|
|
|
|
When Gradle's {maven-plugin}[`maven` plugin] is applied to a project, the Spring Boot
|
|
|
|
|
plugin will configure the `uploadBootArchives` `Upload` task to ensure that no
|
|
|
|
|
dependencies are declared in the pom that it generates.
|