Skip to content

Commit 2ef60a1

Browse files
committed
Clarify how to include devtools using Maven
Closes spring-projectsgh-48641
1 parent 5c2b908 commit 2ef60a1

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

build-plugin/spring-boot-maven-plugin/src/docs/antora/modules/maven-plugin/pages/build-image.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ In the rest of this section, `build-image` is used to refer to either the `build
2323
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.
2424
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.
2525
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).
26+
Pay also attention that optional dependencies are not included by default.
27+
If you have defined those modules as optional, you also need to set the `includeOptional` property to `true`.
2628

2729

2830

build-plugin/spring-boot-maven-plugin/src/docs/antora/modules/maven-plugin/pages/packaging.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ NOTE: The `outputFileNameMapping` feature of the `maven-war-plugin` is currently
2525

2626
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).
2727
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.
28+
Pay also attention that optional dependencies are not included by default.
29+
If you have defined those modules as optional, you also need to set the `includeOptional` property to `true`.
2830

2931
The plugin rewrites your manifest, and in particular it manages the `Main-Class` and `Start-Class` entries.
3032
If the defaults don't work you have to configure the values in the Spring Boot plugin, not in the jar plugin.

documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/using/devtools.adoc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ TIP: Flagging the dependency as optional in Maven or using the `developmentOnly`
3939

4040
TIP: Repackaged archives do not contain devtools by default.
4141
If you want to use a xref:using/devtools.adoc#using.devtools.remote-applications[certain remote devtools feature], you need to include it.
42-
When using the Maven plugin, set the `excludeDevtools` property to `false`.
42+
When using the Maven plugin, opt-in for optional dependencies by setting the `includeOptional` property to `true`.
43+
You also need to set the `excludeDevtools` property to `false`.
4344
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].
4445

4546

@@ -376,13 +377,16 @@ To enable it, you need to make sure that `devtools` is included in the repackage
376377
<groupId>org.springframework.boot</groupId>
377378
<artifactId>spring-boot-maven-plugin</artifactId>
378379
<configuration>
380+
<includeOptional>true</includeOptional>
379381
<excludeDevtools>false</excludeDevtools>
380382
</configuration>
381383
</plugin>
382384
</plugins>
383385
</build>
384386
----
385387

388+
NOTE: Optional dependencies are not included by default, which explains why `includeOptional` is also present.
389+
386390
Then you need to set the configprop:spring.devtools.remote.secret[] property.
387391
Like any important password or secret, the value should be unique and strong such that it cannot be guessed or brute-forced.
388392

0 commit comments

Comments
 (0)