This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Boot 3.4.0!spring-doc.cn

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.spring-doc.cn

Reacting to the Java Plugin

When Gradle’s java plugin is applied to a project, the Spring Boot plugin:spring-doc.cn

  1. Creates a BootJar task named bootJar that 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 in BOOT-INF/classes and jars are packaged in BOOT-INF/libspring-doc.cn

  2. Configures the assemble task to depend on the bootJar task.spring-doc.cn

  3. Configures the jar task to use plain as the convention for its archive classifier.spring-doc.cn

  4. Creates a BootBuildImage task named bootBuildImage that will create a OCI image using a buildpack.spring-doc.cn

  5. Creates a BootRun task named bootRun that can be used to run your application using the main source set to find its main method and provide its runtime classpath.spring-doc.cn

  6. Creates a 'BootRun` task named bootTestRun that can be used to run your application using the test source set to find its main method and provide its runtime classpath.spring-doc.cn

  7. Creates a configuration named bootArchives that contains the artifact produced by the bootJar task.spring-doc.cn

  8. Creates a configuration named developmentOnly for dependencies that are only required at development time, such as Spring Boot’s Devtools, and should not be packaged in executable jars and wars.spring-doc.cn

  9. Creates a configuration named testAndDevelopmentOnly for 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.spring-doc.cn

  10. Creates a configuration named productionRuntimeClasspath. It is equivalent to runtimeClasspath minus any dependencies that only appear in the developmentOnly or testDevelopmentOnly configurations.spring-doc.cn

  11. Configures any JavaCompile tasks with no configured encoding to use UTF-8.spring-doc.cn

  12. Configures any JavaCompile tasks to use the -parameters compiler argument.spring-doc.cn

Reacting to the Kotlin Plugin

When Kotlin’s Gradle plugin is applied to a project, the Spring Boot plugin:spring-doc.cn

  1. Aligns the Kotlin version used in Spring Boot’s dependency management with the version of the plugin. This is achieved by setting the kotlin.version property with a value that matches the version of the Kotlin plugin.spring-doc.cn

  2. Configures any KotlinCompile tasks to use the -java-parameters compiler argument.spring-doc.cn

Reacting to the War Plugin

When Gradle’s war plugin is applied to a project, the Spring Boot plugin:spring-doc.cn

  1. Creates a 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.spring-doc.cn

  2. Configures the assemble task to depend on the bootWar task.spring-doc.cn

  3. Configures the war task to use plain as the convention for its archive classifier.spring-doc.cn

  4. Configures the bootArchives configuration to contain the artifact produced by the bootWar task.spring-doc.cn

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.spring-doc.cn

Reacting to the Application Plugin

When Gradle’s application plugin is applied to a project, the Spring Boot plugin:spring-doc.cn

  1. Creates a CreateStartScripts task named bootStartScripts that will create scripts that launch the artifact in the bootArchives configuration using java -jar. The task is configured to use the applicationDefaultJvmArgs property as a convention for its defaultJvmOpts property.spring-doc.cn

  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.spring-doc.cn

  3. Configures the bootRun task to use the mainClassName property as a convention for its main property.spring-doc.cn

  4. Configures the bootRun and bootTestRun tasks to use the applicationDefaultJvmArgs property as a convention for their jvmArgs property.spring-doc.cn

  5. Configures the bootJar task to use the mainClassName property as a convention for the Start-Class entry in its manifest.spring-doc.cn

  6. Configures the bootWar task to use the mainClassName property as a convention for the Start-Class entry in its manifest.spring-doc.cn

Reacting to the GraalVM Native Image Plugin

When the GraalVM Native Image plugin is applied to a project, the Spring Boot plugin:spring-doc.cn

  1. Applies the org.springframework.boot.aot plugin that:spring-doc.cn

    1. Registers aot and aotTest source sets.spring-doc.cn

    2. Registers a ProcessAot task named processAot that will generate AOT-optimized source for the application in the aot source set.spring-doc.cn

    3. Configures the Java compilation and process resources tasks for the aot source set to depend upon processAot.spring-doc.cn

    4. Registers a ProcessTestAot task named processTestAot that will generated AOT-optimized source for the application’s tests in the aotTest source set.spring-doc.cn

    5. Configures the Java compilation and process resources tasks for the aotTest source set to depend upon processTestAot.spring-doc.cn

  2. Adds the output of the aot source set to the classpath of the main GraalVM native binary.spring-doc.cn

  3. Adds the output of the aotTest source set to the classpath of the test GraalVM native binary.spring-doc.cn

  4. Configures the GraalVM extension to disable Toolchain detection.spring-doc.cn

  5. Configures each GraalVM native binary to require GraalVM 22.3 or later.spring-doc.cn

  6. Configures the bootJar task to include the reachability metadata produced by the collectReachabilityMetadata task in its jar.spring-doc.cn

  7. Configures the bootBuildImage task to use paketobuildpacks/builder-jammy-tiny:latest as its builder and to set BP_NATIVE_IMAGE to true in its environment.spring-doc.cn

Reacting to the CycloneDX Plugin

When the CycloneDX plugin is applied to a project, the Spring Boot plugin:spring-doc.cn

  1. Configures the cyclonedxBom task to use the application project type and output the SBOM to the application.cdx file in JSON format without full license texts.spring-doc.cn

  2. Adds the SBOM under META-INF/sbom in the generated jar or war file.spring-doc.cn

  3. Adds the Sbom-Format and Sbom-Location to the manifest of the jar or war file.spring-doc.cn