From 2ef60a10da2c9bb3788b43577c87db6501ef0967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Tue, 30 Dec 2025 13:18:04 +0100 Subject: [PATCH] Clarify how to include devtools using Maven Closes gh-48641 --- .../docs/antora/modules/maven-plugin/pages/build-image.adoc | 2 ++ .../docs/antora/modules/maven-plugin/pages/packaging.adoc | 2 ++ .../docs/antora/modules/reference/pages/using/devtools.adoc | 6 +++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/build-plugin/spring-boot-maven-plugin/src/docs/antora/modules/maven-plugin/pages/build-image.adoc b/build-plugin/spring-boot-maven-plugin/src/docs/antora/modules/maven-plugin/pages/build-image.adoc index 4b938c38d24..e099dcef4ff 100644 --- a/build-plugin/spring-boot-maven-plugin/src/docs/antora/modules/maven-plugin/pages/build-image.adoc +++ b/build-plugin/spring-boot-maven-plugin/src/docs/antora/modules/maven-plugin/pages/build-image.adoc @@ -23,6 +23,8 @@ In the rest of this section, `build-image` is used to refer to either the `build TIP: While the buildpack runs from an xref:packaging.adoc[executable archive], it is not necessary to execute the `repackage` goal first as the executable archive is created automatically if necessary. When the `build-image` repackages the application, it applies the same settings as the `repackage` goal would, that is dependencies can be excluded using one of the exclude options. The `spring-boot-devtools` and `spring-boot-docker-compose` modules are automatically excluded by default (you can control this using the `excludeDevtools` and `excludeDockerCompose` properties). +Pay also attention that optional dependencies are not included by default. +If you have defined those modules as optional, you also need to set the `includeOptional` property to `true`. diff --git a/build-plugin/spring-boot-maven-plugin/src/docs/antora/modules/maven-plugin/pages/packaging.adoc b/build-plugin/spring-boot-maven-plugin/src/docs/antora/modules/maven-plugin/pages/packaging.adoc index d3ab42b8d52..b0249a0c67d 100644 --- a/build-plugin/spring-boot-maven-plugin/src/docs/antora/modules/maven-plugin/pages/packaging.adoc +++ b/build-plugin/spring-boot-maven-plugin/src/docs/antora/modules/maven-plugin/pages/packaging.adoc @@ -25,6 +25,8 @@ NOTE: The `outputFileNameMapping` feature of the `maven-war-plugin` is currently The `spring-boot-devtools` and `spring-boot-docker-compose` modules are automatically excluded by default (you can control this using the `excludeDevtools` and `excludeDockerCompose` properties). In order to make that work with `war` packaging, the `spring-boot-devtools` and `spring-boot-docker-compose` dependencies must be set as `optional` or with the `provided` scope. +Pay also attention that optional dependencies are not included by default. +If you have defined those modules as optional, you also need to set the `includeOptional` property to `true`. The plugin rewrites your manifest, and in particular it manages the `Main-Class` and `Start-Class` entries. If the defaults don't work you have to configure the values in the Spring Boot plugin, not in the jar plugin. diff --git a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/using/devtools.adoc b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/using/devtools.adoc index b4bd6620e06..ca344d9dc59 100644 --- a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/using/devtools.adoc +++ b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/using/devtools.adoc @@ -39,7 +39,8 @@ TIP: Flagging the dependency as optional in Maven or using the `developmentOnly` TIP: Repackaged archives do not contain devtools by default. If you want to use a xref:using/devtools.adoc#using.devtools.remote-applications[certain remote devtools feature], you need to include it. -When using the Maven plugin, set the `excludeDevtools` property to `false`. +When using the Maven plugin, opt-in for optional dependencies by setting the `includeOptional` property to `true`. +You also need to set the `excludeDevtools` property to `false`. When using the Gradle plugin, xref:gradle-plugin:packaging.adoc#packaging-executable.configuring.including-development-only-dependencies[configure the task's classpath to include the `developmentOnly` configuration]. @@ -376,6 +377,7 @@ To enable it, you need to make sure that `devtools` is included in the repackage org.springframework.boot spring-boot-maven-plugin + true false @@ -383,6 +385,8 @@ To enable it, you need to make sure that `devtools` is included in the repackage ---- +NOTE: Optional dependencies are not included by default, which explains why `includeOptional` is also present. + Then you need to set the configprop:spring.devtools.remote.secret[] property. Like any important password or secret, the value should be unique and strong such that it cannot be guessed or brute-forced.