Align nativeTest to native to make it multi-modules friendly

This commit harmonizes the behavior of the native and nativeTest Maven
profiles. Previously, enabling the nativeTest profile would
automatically add an execution of the Spring Boot and Native Build Tools
plugins, even in a module that doesn't represent an application or a
Spring Boot-related module.

With this commit, the native testing feature is only enabled if the
plugins are defined in the project, either directly, or in a parent.

The documentation has been updated as the behavior of both profiles is
now much more consistent.

Closes gh-44696
This commit is contained in:
Stéphane Nicoll
2025-03-17 11:10:43 +01:00
parent 77159205ed
commit d0cdae2369
4 changed files with 48 additions and 53 deletions

View File

@@ -85,7 +85,9 @@ You should have a `<parent>` section that looks like this:
</parent>
----
The `spring-boot-starter-parent` declares a `nativeTest` profile that configures the executions that are needed to run the native tests.
The `spring-boot-starter-parent` defines a `nativeTest` profile that provides the necessary configuration for the Spring Boot and Native Build Tools plugins.
First you need to add those two plugin in the module to opt-in for the feature.
Your tests are executed in native mode only when the `nativeTest` is enabled.
You can activate profiles using the `-P` flag on the command line.
TIP: If you don't want to use `spring-boot-starter-parent` you'll need to configure executions for the `process-test-aot` goal from the Spring Boot plugin and the `test` goal from the Native Build Tools plugin.