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.
Reacting to the Java Plugin
When Gradle’s java plugin is applied to a project, the Spring Boot plugin:
-
Creates a
BootJartask namedbootJarthat will create an executable, uber jar for the project. The jar will contain everything on the runtime classpath of the main source set; classes are packaged inBOOT-INF/classesand jars are packaged inBOOT-INF/lib -
Configures the
assembletask to depend on thebootJartask. -
Configures the
jartask to useplainas the convention for its archive classifier. -
Creates a
BootBuildImagetask namedbootBuildImagethat will create a OCI image using a buildpack. -
Creates a
BootRuntask namedbootRunthat can be used to run your application using themainsource set to find its main method and provide its runtime classpath. -
Creates a
BootRuntask namedbootTestRunthat can be used to run your application using thetestsource set to find its main method and provide its runtime classpath. -
Creates a configuration named
bootArchivesthat contains the artifact produced by thebootJartask. -
Creates a configuration named
developmentOnlyfor dependencies that are only required at development time, such as Spring Boot’s Devtools, and should not be packaged in executable jars and wars. -
Creates a configuration named
testAndDevelopmentOnlyfor dependencies that are only required at development time and when writing and running tests and that should not be packaged in executable jars and wars. -
Creates a configuration named
productionRuntimeClasspath. It is equivalent toruntimeClasspathminus any dependencies that only appear in thedevelopmentOnlyortestDevelopmentOnlyconfigurations. -
Configures any
JavaCompiletasks with no configured encoding to useUTF-8. -
Configures any
JavaCompiletasks to use the-parameterscompiler argument.
Reacting to the Kotlin Plugin
When Kotlin’s Gradle plugin is applied to a project, the Spring Boot plugin:
-
Aligns the Kotlin version used in Spring Boot’s dependency management with the version of the plugin. This is achieved by setting the
kotlin.versionproperty with a value that matches the version of the Kotlin plugin. -
Configures any
KotlinCompiletasks to use the-java-parameterscompiler argument.
Reacting to the War Plugin
When Gradle’s war plugin is applied to a project, the Spring Boot plugin:
-
Creates a
BootWartask namedbootWarthat will create an executable, fat war for the project. In addition to the standard packaging, everything in theprovidedRuntimeconfiguration will be packaged inWEB-INF/lib-provided. -
Configures the
assembletask to depend on thebootWartask. -
Configures the
wartask to useplainas the convention for its archive classifier. -
Configures the
bootArchivesconfiguration to contain the artifact produced by thebootWartask.
Reacting to the Dependency Management Plugin
When the io.spring.dependency-management plugin is applied to a project, the Spring Boot plugin will automatically import the spring-boot-dependencies bom.
Reacting to the Application Plugin
When Gradle’s application plugin is applied to a project, the Spring Boot plugin:
-
Creates a
CreateStartScriptstask namedbootStartScriptsthat will create scripts that launch the artifact in thebootArchivesconfiguration usingjava -jar. The task is configured to use theapplicationDefaultJvmArgsproperty as a convention for itsdefaultJvmOptsproperty. -
Creates a new distribution named
bootand configures it to contain the artifact in thebootArchivesconfiguration in itslibdirectory and the start scripts in itsbindirectory. -
Configures the
bootRuntask to use themainClassNameproperty as a convention for itsmainproperty. -
Configures the
bootRunandbootTestRuntasks to use theapplicationDefaultJvmArgsproperty as a convention for theirjvmArgsproperty. -
Configures the
bootJartask to use themainClassNameproperty as a convention for theStart-Classentry in its manifest. -
Configures the
bootWartask to use themainClassNameproperty as a convention for theStart-Classentry in its manifest.
Reacting to the GraalVM Native Image Plugin
When the GraalVM Native Image plugin is applied to a project, the Spring Boot plugin:
-
Applies the
org.springframework.boot.aotplugin that:-
Registers
aotandaotTestsource sets. -
Registers a
ProcessAottask namedprocessAotthat will generate AOT-optimized source for the application in theaotsource set. -
Configures the Java compilation and process resources tasks for the
aotsource set to depend uponprocessAot. -
Registers a
ProcessTestAottask namedprocessTestAotthat will generated AOT-optimized source for the application’s tests in theaotTestsource set. -
Configures the Java compilation and process resources tasks for the
aotTestsource set to depend uponprocessTestAot.
-
-
Adds the output of the
aotsource set to the classpath of themainGraalVM native binary. -
Adds the output of the
aotTestsource set to the classpath of thetestGraalVM native binary. -
Configures the GraalVM extension to disable Toolchain detection.
-
Configures each GraalVM native binary to require GraalVM 22.3 or later.
-
Configures the
bootJartask to include the reachability metadata produced by thecollectReachabilityMetadatatask in its jar. -
Configures the
bootJartask to add theSpring-Boot-Native-Processed: truemanifest entry.
Reacting to the CycloneDX Plugin
When the CycloneDX plugin is applied to a project, the Spring Boot plugin:
-
Configures the
cyclonedxBomtask to use theapplicationproject type and output the SBOM to theapplication.cdxfile in JSON format without full license texts. -
Adds the SBOM under
META-INF/sbomin the generated jar or war file. -
Adds the
Sbom-FormatandSbom-Locationto the manifest of the jar or war file.