From e7566e968e8ebebe8a7fdad9d242c1bab399ca37 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 3 Mar 2022 20:27:46 +0000 Subject: [PATCH] Use configuration avoidance APIs in Gradle plugin's docs Closes gh-30056 --- .../getting-started/typical-plugins.gradle.kts | 2 +- .../custom-version.gradle.kts | 2 +- .../packaging/boot-build-image-builder.gradle | 6 +++--- .../packaging/boot-build-image-builder.gradle.kts | 4 ++-- .../packaging/boot-build-image-buildpacks.gradle | 4 ++-- .../boot-build-image-buildpacks.gradle.kts | 2 +- .../boot-build-image-docker-auth-token.gradle | 6 +++--- .../boot-build-image-docker-auth-token.gradle.kts | 4 ++-- .../boot-build-image-docker-auth-user.gradle | 6 +++--- .../boot-build-image-docker-auth-user.gradle.kts | 4 ++-- .../packaging/boot-build-image-docker-host.gradle | 6 +++--- .../boot-build-image-docker-host.gradle.kts | 4 ++-- .../packaging/boot-build-image-env-proxy.gradle | 4 ++-- .../boot-build-image-env-proxy.gradle.kts | 2 +- .../packaging/boot-build-image-env-runtime.gradle | 6 +++--- .../boot-build-image-env-runtime.gradle.kts | 2 +- .../gradle/packaging/boot-build-image-env.gradle | 4 ++-- .../packaging/boot-build-image-env.gradle.kts | 2 +- .../gradle/packaging/boot-build-image-name.gradle | 10 +++++----- .../packaging/boot-build-image-name.gradle.kts | 8 ++++---- .../packaging/boot-build-image-publish.gradle | 12 ++++++------ .../packaging/boot-build-image-publish.gradle.kts | 10 +++++----- .../packaging/boot-jar-and-jar-classifiers.gradle | 6 +++--- .../boot-jar-and-jar-classifiers.gradle.kts | 6 +++--- .../packaging/boot-jar-custom-launch-script.gradle | 4 ++-- .../boot-jar-custom-launch-script.gradle.kts | 4 ++-- .../boot-jar-include-launch-script.gradle | 4 ++-- .../boot-jar-include-launch-script.gradle.kts | 4 ++-- .../boot-jar-launch-script-properties.gradle | 4 ++-- .../boot-jar-launch-script-properties.gradle.kts | 4 ++-- .../packaging/boot-jar-layered-custom.gradle | 4 ++-- .../packaging/boot-jar-layered-custom.gradle.kts | 4 ++-- .../packaging/boot-jar-layered-disabled.gradle | 4 ++-- .../packaging/boot-jar-layered-disabled.gradle.kts | 4 ++-- .../boot-jar-layered-exclude-tools.gradle | 4 ++-- .../boot-jar-layered-exclude-tools.gradle.kts | 4 ++-- .../gradle/packaging/boot-jar-main-class.gradle | 2 +- .../packaging/boot-jar-main-class.gradle.kts | 2 +- .../packaging/boot-jar-manifest-main-class.gradle | 2 +- .../boot-jar-manifest-main-class.gradle.kts | 2 +- .../packaging/boot-jar-requires-unpack.gradle | 4 ++-- .../packaging/boot-jar-requires-unpack.gradle.kts | 4 ++-- .../packaging/boot-war-include-devtools.gradle | 4 ++-- .../packaging/boot-war-include-devtools.gradle.kts | 4 ++-- .../packaging/boot-war-properties-launcher.gradle | 4 ++-- .../boot-war-properties-launcher.gradle.kts | 4 ++-- .../src/docs/gradle/packaging/only-boot-jar.gradle | 4 ++-- .../docs/gradle/packaging/only-boot-jar.gradle.kts | 4 ++-- .../docs/gradle/publishing/maven-publish.gradle | 4 ++-- .../gradle/publishing/maven-publish.gradle.kts | 4 ++-- .../src/docs/gradle/publishing/maven.gradle | 4 ++-- .../src/docs/gradle/publishing/maven.gradle.kts | 14 +++++++------- .../boot-run-disable-optimized-launch.gradle | 4 ++-- .../boot-run-disable-optimized-launch.gradle.kts | 4 ++-- .../src/docs/gradle/running/boot-run-main.gradle | 4 ++-- .../docs/gradle/running/boot-run-main.gradle.kts | 4 ++-- .../running/boot-run-source-resources.gradle | 4 ++-- .../running/boot-run-source-resources.gradle.kts | 4 ++-- .../gradle/running/boot-run-system-property.gradle | 4 ++-- .../running/boot-run-system-property.gradle.kts | 6 +++--- 60 files changed, 135 insertions(+), 135 deletions(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/getting-started/typical-plugins.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/getting-started/typical-plugins.gradle.kts index f395172ce572..754080730e32 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/getting-started/typical-plugins.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/getting-started/typical-plugins.gradle.kts @@ -7,7 +7,7 @@ plugins { apply(plugin = "io.spring.dependency-management") // end::apply[] -task("verify") { +tasks.register("verify") { doLast { project.plugins.getPlugin(JavaPlugin::class) project.plugins.getPlugin(io.spring.gradle.dependencymanagement.DependencyManagementPlugin::class) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/custom-version.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/custom-version.gradle.kts index 0e0dc5388fac..a8359facf42d 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/custom-version.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/custom-version.gradle.kts @@ -26,7 +26,7 @@ the().apply { } } -task("slf4jVersion") { +tasks.register("slf4jVersion") { doLast { println(project.the().managedVersions["org.slf4j:slf4j-api"]) } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-builder.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-builder.gradle index 50ca6e1b7db3..520787b2edc5 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-builder.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-builder.gradle @@ -3,18 +3,18 @@ plugins { id 'org.springframework.boot' version '{gradle-project-version}' } -bootJar { +tasks.named("bootJar") { mainClass = 'com.example.ExampleApplication' } // tag::builder[] -bootBuildImage { +tasks.named("bootBuildImage") { builder = "mine/java-cnb-builder" runImage = "mine/java-cnb-run" } // end::builder[] -task bootBuildImageBuilder { +tasks.register("bootBuildImageBuilder") { doFirst { println("builder=${tasks.bootBuildImage.builder}") println("runImage=${tasks.bootBuildImage.runImage}") diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-builder.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-builder.gradle.kts index c180ca27ff1e..23aa9bd0105d 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-builder.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-builder.gradle.kts @@ -6,12 +6,12 @@ plugins { id("org.springframework.boot") version "{gradle-project-version}" } -tasks.getByName("bootJar") { +tasks.named("bootJar") { mainClass.set("com.example.ExampleApplication") } // tag::builder[] -tasks.getByName("bootBuildImage") { +tasks.named("bootBuildImage") { builder = "mine/java-cnb-builder" runImage = "mine/java-cnb-run" } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-buildpacks.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-buildpacks.gradle index c1f5c6745e4c..ab0293db49ba 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-buildpacks.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-buildpacks.gradle @@ -4,12 +4,12 @@ plugins { } // tag::buildpacks[] -bootBuildImage { +tasks.named("bootBuildImage") { buildpacks = ["file:///path/to/example-buildpack.tgz", "urn:cnb:builder:paketo-buildpacks/java"] } // end::buildpacks[] -task bootBuildImageBuildpacks { +tasks.register("bootBuildImageBuildpacks") { doFirst { bootBuildImage.buildpacks.each { reference -> println "$reference" } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-buildpacks.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-buildpacks.gradle.kts index 9df9bd72bd30..2de322927210 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-buildpacks.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-buildpacks.gradle.kts @@ -6,7 +6,7 @@ plugins { } // tag::buildpacks[] -tasks.getByName("bootBuildImage") { +tasks.named("bootBuildImage") { buildpacks = listOf("file:///path/to/example-buildpack.tgz", "urn:cnb:builder:paketo-buildpacks/java") } // end::buildpacks[] diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-auth-token.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-auth-token.gradle index 4ebde0a9498a..4e917c2e3f3d 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-auth-token.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-auth-token.gradle @@ -3,12 +3,12 @@ plugins { id 'org.springframework.boot' version '{gradle-project-version}' } -bootJar { +tasks.named("bootJar") { mainClass = 'com.example.ExampleApplication' } // tag::docker-auth-token[] -bootBuildImage { +tasks.named("bootBuildImage") { docker { builderRegistry { token = "9cbaf023786cd7..." @@ -17,7 +17,7 @@ bootBuildImage { } // end::docker-auth-token[] -task bootBuildImageDocker { +tasks.register("bootBuildImageDocker") { doFirst { println("token=${tasks.bootBuildImage.docker.builderRegistry.token}") } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-auth-token.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-auth-token.gradle.kts index a218863cf1d1..44a7c26b2a38 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-auth-token.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-auth-token.gradle.kts @@ -6,12 +6,12 @@ plugins { id("org.springframework.boot") version "{gradle-project-version}" } -tasks.getByName("bootJar") { +tasks.named("bootJar") { mainClass.set("com.example.ExampleApplication") } // tag::docker-auth-token[] -tasks.getByName("bootBuildImage") { +tasks.named("bootBuildImage") { docker { builderRegistry { token = "9cbaf023786cd7..." diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-auth-user.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-auth-user.gradle index 955cd8993b7b..a51c09bd98a4 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-auth-user.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-auth-user.gradle @@ -3,12 +3,12 @@ plugins { id 'org.springframework.boot' version '{gradle-project-version}' } -bootJar { +tasks.named("bootJar") { mainClass = 'com.example.ExampleApplication' } // tag::docker-auth-user[] -bootBuildImage { +tasks.named("bootBuildImage") { docker { builderRegistry { username = "user" @@ -20,7 +20,7 @@ bootBuildImage { } // end::docker-auth-user[] -task bootBuildImageDocker { +tasks.register("bootBuildImageDocker") { doFirst { println("username=${tasks.bootBuildImage.docker.builderRegistry.username}") println("password=${tasks.bootBuildImage.docker.builderRegistry.password}") diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-auth-user.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-auth-user.gradle.kts index 7745b7d59acc..737fe63b377c 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-auth-user.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-auth-user.gradle.kts @@ -6,12 +6,12 @@ plugins { id("org.springframework.boot") version "{gradle-project-version}" } -tasks.getByName("bootJar") { +tasks.named("bootJar") { mainClass.set("com.example.ExampleApplication") } // tag::docker-auth-user[] -tasks.getByName("bootBuildImage") { +tasks.named("bootBuildImage") { docker { builderRegistry { username = "user" diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-host.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-host.gradle index 890f838cebff..8ee8a2d67dce 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-host.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-host.gradle @@ -3,12 +3,12 @@ plugins { id 'org.springframework.boot' version '{gradle-project-version}' } -bootJar { +tasks.named("bootJar") { mainClass = 'com.example.ExampleApplication' } // tag::docker-host[] -bootBuildImage { +tasks.named("bootBuildImage") { docker { host = "tcp://192.168.99.100:2376" tlsVerify = true @@ -17,7 +17,7 @@ bootBuildImage { } // end::docker-host[] -task bootBuildImageDocker { +tasks.register("bootBuildImageDocker") { doFirst { println("host=${tasks.bootBuildImage.docker.host}") println("tlsVerify=${tasks.bootBuildImage.docker.tlsVerify}") diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-host.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-host.gradle.kts index 5adeb830b2ce..3b726997456d 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-host.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-docker-host.gradle.kts @@ -6,12 +6,12 @@ plugins { id("org.springframework.boot") version "{gradle-project-version}" } -tasks.getByName("bootJar") { +tasks.named("bootJar") { mainClass.set("com.example.ExampleApplication") } // tag::docker-host[] -tasks.getByName("bootBuildImage") { +tasks.named("bootBuildImage") { docker { host = "tcp://192.168.99.100:2376" isTlsVerify = true diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env-proxy.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env-proxy.gradle index 84a3b105ae4f..71922f44902d 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env-proxy.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env-proxy.gradle @@ -4,7 +4,7 @@ plugins { } // tag::env[] -bootBuildImage { +tasks.named("bootBuildImage") { environment = [ "HTTP_PROXY" : "http://proxy.example.com", "HTTPS_PROXY": "https://proxy.example.com" @@ -12,7 +12,7 @@ bootBuildImage { } // end::env[] -task bootBuildImageEnvironment { +tasks.register("bootBuildImageEnvironment") { doFirst { bootBuildImage.environment.each { name, value -> println "$name=$value" } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env-proxy.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env-proxy.gradle.kts index 723790814c85..bf265f8b5c5f 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env-proxy.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env-proxy.gradle.kts @@ -6,7 +6,7 @@ plugins { } // tag::env[] -tasks.getByName("bootBuildImage") { +tasks.named("bootBuildImage") { environment = mapOf("HTTP_PROXY" to "http://proxy.example.com", "HTTPS_PROXY" to "https://proxy.example.com") } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env-runtime.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env-runtime.gradle index 1220d6f4f0f2..3b0c454d7fa3 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env-runtime.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env-runtime.gradle @@ -3,12 +3,12 @@ plugins { id 'org.springframework.boot' version '{gradle-project-version}' } -bootJar { +tasks.named("bootJar") { mainClass = 'com.example.ExampleApplication' } // tag::env-runtime[] -bootBuildImage { +tasks.named("bootBuildImage") { environment = [ "BPE_DELIM_JAVA_TOOL_OPTIONS" : " ", "BPE_APPEND_JAVA_TOOL_OPTIONS" : "-XX:+HeapDumpOnOutOfMemoryError" @@ -16,7 +16,7 @@ bootBuildImage { } // end::env-runtime[] -task bootBuildImageEnvironment { +tasks.register("bootBuildImageEnvironment") { doFirst { bootBuildImage.environment.each { name, value -> println "$name=$value" } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env-runtime.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env-runtime.gradle.kts index a98d23ebfa45..9140d8182dd9 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env-runtime.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env-runtime.gradle.kts @@ -6,7 +6,7 @@ plugins { } // tag::env-runtime[] -tasks.getByName("bootBuildImage") { +tasks.named("bootBuildImage") { environment = mapOf( "BPE_DELIM_JAVA_TOOL_OPTIONS" to " ", "BPE_APPEND_JAVA_TOOL_OPTIONS" to "-XX:+HeapDumpOnOutOfMemoryError" diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env.gradle index a9a7e9bc29d7..71d3948193c7 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env.gradle @@ -4,12 +4,12 @@ plugins { } // tag::env[] -bootBuildImage { +tasks.named("bootBuildImage") { environment = ["BP_JVM_VERSION" : "8.*"] } // end::env[] -task bootBuildImageEnvironment { +tasks.register("bootBuildImageEnvironment") { doFirst { bootBuildImage.environment.each { name, value -> println "$name=$value" } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env.gradle.kts index 488e56830de7..9613fe8c05fc 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env.gradle.kts @@ -6,7 +6,7 @@ plugins { } // tag::env[] -tasks.getByName("bootBuildImage") { +tasks.named("bootBuildImage") { environment = mapOf("BP_JVM_VERSION" to "8.*") } // end::env[] diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-name.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-name.gradle index c1893e37d924..1eaa8d03d799 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-name.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-name.gradle @@ -4,13 +4,13 @@ plugins { } // tag::image-name[] -bootBuildImage { +tasks.named("bootBuildImage") { imageName = "example.com/library/${project.name}" } // end::image-name[] -task bootBuildImageName { - doFirst { - println(tasks.bootBuildImage.imageName) - } +tasks.register("bootBuildImageName") { + doFirst { + println(tasks.bootBuildImage.imageName) + } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-name.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-name.gradle.kts index e7f21592b707..d043937d0c40 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-name.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-name.gradle.kts @@ -6,13 +6,13 @@ plugins { } // tag::image-name[] -tasks.getByName("bootBuildImage") { +tasks.named("bootBuildImage") { imageName = "example.com/library/${project.name}" } // end::image-name[] tasks.register("bootBuildImageName") { - doFirst { - println(tasks.getByName("bootBuildImage").imageName) - } + doFirst { + println(tasks.getByName("bootBuildImage").imageName) + } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-publish.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-publish.gradle index 48e140a6aac3..f3603a4405f9 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-publish.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-publish.gradle @@ -3,12 +3,12 @@ plugins { id 'org.springframework.boot' version '{gradle-project-version}' } -bootJar { +tasks.named("bootJar") { mainClass = 'com.example.ExampleApplication' } // tag::publish[] -bootBuildImage { +tasks.named("bootBuildImage") { imageName = "docker.example.com/library/${project.name}" publish = true docker { @@ -22,8 +22,8 @@ bootBuildImage { } // end::publish[] -task bootBuildImagePublish { - doFirst { - println(tasks.bootBuildImage.publish) - } +tasks.register("bootBuildImagePublish") { + doFirst { + println(tasks.bootBuildImage.publish) + } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-publish.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-publish.gradle.kts index ea425c77ea05..6c6d11423019 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-publish.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-publish.gradle.kts @@ -6,12 +6,12 @@ plugins { id("org.springframework.boot") version "{gradle-project-version}" } -tasks.getByName("bootJar") { +tasks.named("bootJar") { mainClass.set("com.example.ExampleApplication") } // tag::publish[] -tasks.getByName("bootBuildImage") { +tasks.named("bootBuildImage") { imageName = "docker.example.com/library/${project.name}" isPublish = true docker { @@ -26,7 +26,7 @@ tasks.getByName("bootBuildImage") { // end::publish[] tasks.register("bootBuildImagePublish") { - doFirst { - println(tasks.getByName("bootBuildImage").isPublish) - } + doFirst { + println(tasks.getByName("bootBuildImage").isPublish) + } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-and-jar-classifiers.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-and-jar-classifiers.gradle index 2939641c414a..024266d70125 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-and-jar-classifiers.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-and-jar-classifiers.gradle @@ -4,15 +4,15 @@ plugins { } // tag::classifiers[] -bootJar { +tasks.named("bootJar") { archiveClassifier = 'boot' } -jar { +tasks.named("jar") { archiveClassifier = '' } // end::classifiers[] -bootJar { +tasks.named("bootJar") { mainClass = 'com.example.Application' } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-and-jar-classifiers.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-and-jar-classifiers.gradle.kts index cc571d2c6ab2..f54362da9c40 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-and-jar-classifiers.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-and-jar-classifiers.gradle.kts @@ -6,15 +6,15 @@ plugins { } // tag::classifiers[] -tasks.getByName("bootJar") { +tasks.named("bootJar") { archiveClassifier.set("boot") } -tasks.getByName("jar") { +tasks.named("jar") { archiveClassifier.set("") } // end::classifiers[] -tasks.getByName("bootJar") { +tasks.named("bootJar") { mainClass.set("com.example.Application") } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-custom-launch-script.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-custom-launch-script.gradle index d97dcc95c9bf..da6918c0762f 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-custom-launch-script.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-custom-launch-script.gradle @@ -3,12 +3,12 @@ plugins { id 'org.springframework.boot' version '{gradle-project-version}' } -bootJar { +tasks.named("bootJar") { mainClass = 'com.example.ExampleApplication' } // tag::custom-launch-script[] -bootJar { +tasks.named("bootJar") { launchScript { script = file('src/custom.script') } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-custom-launch-script.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-custom-launch-script.gradle.kts index 210debdad755..a3e15f1f5eea 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-custom-launch-script.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-custom-launch-script.gradle.kts @@ -5,12 +5,12 @@ plugins { id("org.springframework.boot") version "{gradle-project-version}" } -tasks.getByName("bootJar") { +tasks.named("bootJar") { mainClass.set("com.example.ExampleApplication") } // tag::custom-launch-script[] -tasks.getByName("bootJar") { +tasks.named("bootJar") { launchScript { script = file("src/custom.script") } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-include-launch-script.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-include-launch-script.gradle index 43bba7349d3d..c1f3d348a844 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-include-launch-script.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-include-launch-script.gradle @@ -3,12 +3,12 @@ plugins { id 'org.springframework.boot' version '{gradle-project-version}' } -bootJar { +tasks.named("bootJar") { mainClass = 'com.example.ExampleApplication' } // tag::include-launch-script[] -bootJar { +tasks.named("bootJar") { launchScript() } // end::include-launch-script[] diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-include-launch-script.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-include-launch-script.gradle.kts index 24c44610c21e..7ffdf42e4f96 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-include-launch-script.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-include-launch-script.gradle.kts @@ -5,12 +5,12 @@ plugins { id("org.springframework.boot") version "{gradle-project-version}" } -tasks.getByName("bootJar") { +tasks.named("bootJar") { mainClass.set("com.example.ExampleApplication") } // tag::include-launch-script[] -tasks.getByName("bootJar") { +tasks.named("bootJar") { launchScript() } // end::include-launch-script[] diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-launch-script-properties.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-launch-script-properties.gradle index 68c8f0799856..6f1df662beb4 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-launch-script-properties.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-launch-script-properties.gradle @@ -3,12 +3,12 @@ plugins { id 'org.springframework.boot' version '{gradle-project-version}' } -bootJar { +tasks.named("bootJar") { mainClass = 'com.example.ExampleApplication' } // tag::launch-script-properties[] -bootJar { +tasks.named("bootJar") { launchScript { properties 'logFilename': 'example-app.log' } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-launch-script-properties.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-launch-script-properties.gradle.kts index 992e8ac3eb87..b3e4206ca958 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-launch-script-properties.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-launch-script-properties.gradle.kts @@ -5,12 +5,12 @@ plugins { id("org.springframework.boot") version "{gradle-project-version}" } -tasks.getByName("bootJar") { +tasks.named("bootJar") { mainClass.set("com.example.ExampleApplication") } // tag::launch-script-properties[] -tasks.getByName("bootJar") { +tasks.named("bootJar") { launchScript { properties(mapOf("logFilename" to "example-app.log")) } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-custom.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-custom.gradle index 2e89d340902d..ba0dde4dc051 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-custom.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-custom.gradle @@ -3,12 +3,12 @@ plugins { id 'org.springframework.boot' version '{gradle-project-version}' } -bootJar { +tasks.named("bootJar") { mainClass = 'com.example.ExampleApplication' } // tag::layered[] -bootJar { +tasks.named("bootJar") { layered { application { intoLayer("spring-boot-loader") { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-custom.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-custom.gradle.kts index 6ec2cadf76b8..851ee90179f5 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-custom.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-custom.gradle.kts @@ -5,12 +5,12 @@ plugins { id("org.springframework.boot") version "{gradle-project-version}" } -tasks.getByName("bootJar") { +tasks.named("bootJar") { mainClass.set("com.example.ExampleApplication") } // tag::layered[] -tasks.getByName("bootJar") { +tasks.named("bootJar") { layered { application { intoLayer("spring-boot-loader") { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-disabled.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-disabled.gradle index 3f660bca4234..3ea9a6277269 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-disabled.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-disabled.gradle @@ -3,12 +3,12 @@ plugins { id 'org.springframework.boot' version '{gradle-project-version}' } -bootJar { +tasks.named("bootJar") { mainClass = 'com.example.ExampleApplication' } // tag::layered[] -bootJar { +tasks.named("bootJar") { layered { enabled = false } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-disabled.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-disabled.gradle.kts index ae8f6c185e1b..9ced3e713840 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-disabled.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-disabled.gradle.kts @@ -5,12 +5,12 @@ plugins { id("org.springframework.boot") version "{gradle-project-version}" } -tasks.getByName("bootJar") { +tasks.named("bootJar") { mainClass.set("com.example.ExampleApplication") } // tag::layered[] -tasks.getByName("bootJar") { +tasks.named("bootJar") { layered { isEnabled = false } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-exclude-tools.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-exclude-tools.gradle index 0ba07ac60d1c..7175092af835 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-exclude-tools.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-exclude-tools.gradle @@ -3,12 +3,12 @@ plugins { id 'org.springframework.boot' version '{gradle-project-version}' } -bootJar { +tasks.named("bootJar") { mainClass = 'com.example.ExampleApplication' } // tag::layered[] -bootJar { +tasks.named("bootJar") { layered { includeLayerTools = false } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-exclude-tools.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-exclude-tools.gradle.kts index 552952366807..bababaa61b31 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-exclude-tools.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-exclude-tools.gradle.kts @@ -5,12 +5,12 @@ plugins { id("org.springframework.boot") version "{gradle-project-version}" } -tasks.getByName("bootJar") { +tasks.named("bootJar") { mainClass.set("com.example.ExampleApplication") } // tag::layered[] -tasks.getByName("bootJar") { +tasks.named("bootJar") { layered { isIncludeLayerTools = false } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-main-class.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-main-class.gradle index 6a548bd3d51b..55b9de16f35c 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-main-class.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-main-class.gradle @@ -4,7 +4,7 @@ plugins { } // tag::main-class[] -bootJar { +tasks.named("bootJar") { mainClass = 'com.example.ExampleApplication' } // end::main-class[] diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-main-class.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-main-class.gradle.kts index 64f87c333fed..48aea9b011a4 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-main-class.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-main-class.gradle.kts @@ -6,7 +6,7 @@ plugins { } // tag::main-class[] -tasks.getByName("bootJar") { +tasks.named("bootJar") { mainClass.set("com.example.ExampleApplication") } // end::main-class[] diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-manifest-main-class.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-manifest-main-class.gradle index 766fa759e890..f384d8e6a6b5 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-manifest-main-class.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-manifest-main-class.gradle @@ -4,7 +4,7 @@ plugins { } // tag::main-class[] -bootJar { +tasks.named("bootJar") { manifest { attributes 'Start-Class': 'com.example.ExampleApplication' } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-manifest-main-class.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-manifest-main-class.gradle.kts index d26c9f5cda54..a79bc048cb7f 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-manifest-main-class.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-manifest-main-class.gradle.kts @@ -6,7 +6,7 @@ plugins { } // tag::main-class[] -tasks.getByName("bootJar") { +tasks.named("bootJar") { manifest { attributes("Start-Class" to "com.example.ExampleApplication") } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-requires-unpack.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-requires-unpack.gradle index ec798043d3c0..3274bdb59461 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-requires-unpack.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-requires-unpack.gradle @@ -11,12 +11,12 @@ dependencies { runtimeOnly('org.jruby:jruby-complete:1.7.25') } -bootJar { +tasks.named("bootJar") { mainClass = 'com.example.ExampleApplication' } // tag::requires-unpack[] -bootJar { +tasks.named("bootJar") { requiresUnpack '**/jruby-complete-*.jar' } // end::requires-unpack[] diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-requires-unpack.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-requires-unpack.gradle.kts index e88d8f3d827d..4f68e068e6a3 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-requires-unpack.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-requires-unpack.gradle.kts @@ -13,12 +13,12 @@ dependencies { runtimeOnly("org.jruby:jruby-complete:1.7.25") } -tasks.getByName("bootJar") { +tasks.named("bootJar") { mainClass.set("com.example.ExampleApplication") } // tag::requires-unpack[] -tasks.getByName("bootJar") { +tasks.named("bootJar") { requiresUnpack("**/jruby-complete-*.jar") } // end::requires-unpack[] diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-war-include-devtools.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-war-include-devtools.gradle index 4efea4455d32..1f12601ca74f 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-war-include-devtools.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-war-include-devtools.gradle @@ -3,7 +3,7 @@ plugins { id 'org.springframework.boot' version '{gradle-project-version}' } -bootWar { +tasks.named("bootWar") { mainClass = 'com.example.ExampleApplication' } @@ -12,7 +12,7 @@ dependencies { } // tag::include-devtools[] -bootWar { +tasks.named("bootWar") { classpath configurations.developmentOnly } // end::include-devtools[] diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-war-include-devtools.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-war-include-devtools.gradle.kts index 5af9e5d81a5b..c151efe9e5ec 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-war-include-devtools.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-war-include-devtools.gradle.kts @@ -5,7 +5,7 @@ plugins { id("org.springframework.boot") version "{gradle-project-version}" } -tasks.getByName("bootWar") { +tasks.named("bootWar") { mainClass.set("com.example.ExampleApplication") } @@ -14,7 +14,7 @@ dependencies { } // tag::include-devtools[] -tasks.getByName("bootWar") { +tasks.named("bootWar") { classpath(configurations["developmentOnly"]) } // end::include-devtools[] diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-war-properties-launcher.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-war-properties-launcher.gradle index 3c1bf08c1d78..2872469f60fb 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-war-properties-launcher.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-war-properties-launcher.gradle @@ -3,12 +3,12 @@ plugins { id 'org.springframework.boot' version '{gradle-project-version}' } -bootWar { +tasks.named("bootWar") { mainClass = 'com.example.ExampleApplication' } // tag::properties-launcher[] -bootWar { +tasks.named("bootWar") { manifest { attributes 'Main-Class': 'org.springframework.boot.loader.PropertiesLauncher' } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-war-properties-launcher.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-war-properties-launcher.gradle.kts index 8873f0a38bfa..19d723b795fa 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-war-properties-launcher.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-war-properties-launcher.gradle.kts @@ -5,12 +5,12 @@ plugins { id("org.springframework.boot") version "{gradle-project-version}" } -tasks.getByName("bootWar") { +tasks.named("bootWar") { mainClass.set("com.example.ExampleApplication") } // tag::properties-launcher[] -tasks.getByName("bootWar") { +tasks.named("bootWar") { manifest { attributes("Main-Class" to "org.springframework.boot.loader.PropertiesLauncher") } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/only-boot-jar.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/only-boot-jar.gradle index 6f8ef2b67c1d..748aa957f381 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/only-boot-jar.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/only-boot-jar.gradle @@ -4,11 +4,11 @@ plugins { } // tag::disable-jar[] -jar { +tasks.named("jar") { enabled = false } // end::disable-jar[] -bootJar { +tasks.named("bootJar") { mainClass = 'com.example.Application' } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/only-boot-jar.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/only-boot-jar.gradle.kts index 2e6686bfb0c6..c15f189fdca4 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/only-boot-jar.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/only-boot-jar.gradle.kts @@ -6,11 +6,11 @@ plugins { } // tag::disable-jar[] -tasks.getByName("jar") { +tasks.named("jar") { enabled = false } // end::disable-jar[] -tasks.getByName("bootJar") { +tasks.named("bootJar") { mainClass.set("com.example.Application") } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/publishing/maven-publish.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/publishing/maven-publish.gradle index 610ceb0a0c02..418c5f101fa6 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/publishing/maven-publish.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/publishing/maven-publish.gradle @@ -8,7 +8,7 @@ plugins { publishing { publications { bootJava(MavenPublication) { - artifact bootJar + artifact tasks.named("bootJar") } } repositories { @@ -19,7 +19,7 @@ publishing { } // end::publishing[] -task publishingConfiguration { +tasks.register("publishingConfiguration") { doLast { println publishing.publications.bootJava println publishing.repositories.maven.url diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/publishing/maven-publish.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/publishing/maven-publish.gradle.kts index cc6df0ffa4de..f11d2344cf65 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/publishing/maven-publish.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/publishing/maven-publish.gradle.kts @@ -8,7 +8,7 @@ plugins { publishing { publications { create("bootJava") { - artifact(tasks.getByName("bootJar")) + artifact(tasks.named("bootJar")) } } repositories { @@ -19,7 +19,7 @@ publishing { } // end::publishing[] -task("publishingConfiguration") { +tasks.register("publishingConfiguration") { doLast { println(publishing.publications["bootJava"]) println(publishing.repositories.getByName("maven").url) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/publishing/maven.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/publishing/maven.gradle index 6f5714457bd4..f568417d8816 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/publishing/maven.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/publishing/maven.gradle @@ -5,7 +5,7 @@ plugins { } // tag::upload[] -uploadBootArchives { +tasks.named("uploadBootArchives") { repositories { mavenDeployer { repository url: 'https://repo.example.com' @@ -14,7 +14,7 @@ uploadBootArchives { } // end::upload[] -task deployerRepository { +tasks.register("deployerRepository") { doLast { println uploadBootArchives.repositories.mavenDeployer.repository.url } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/publishing/maven.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/publishing/maven.gradle.kts index 680605a12601..7bb2c9043775 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/publishing/maven.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/publishing/maven.gradle.kts @@ -5,7 +5,7 @@ plugins { } // tag::upload[] -tasks.getByName("uploadBootArchives") { +tasks.named("uploadBootArchives") { repositories.withGroovyBuilder { "mavenDeployer" { "repository"("url" to "https://repo.example.com") @@ -14,13 +14,13 @@ tasks.getByName("uploadBootArchives") { } // end::upload[] -val url = tasks.getByName("uploadBootArchives") - .repositories - .withGroovyBuilder { getProperty("mavenDeployer") } - .withGroovyBuilder { getProperty("repository") } - .withGroovyBuilder { getProperty("url") } -task("deployerRepository") { +tasks.register("deployerRepository") { doLast { + val url = tasks.getByName("uploadBootArchives") + .repositories + .withGroovyBuilder { getProperty("mavenDeployer") } + .withGroovyBuilder { getProperty("repository") } + .withGroovyBuilder { getProperty("url") } println(url) } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-disable-optimized-launch.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-disable-optimized-launch.gradle index 4b95b69db9a0..e1529d17cfca 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-disable-optimized-launch.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-disable-optimized-launch.gradle @@ -4,12 +4,12 @@ plugins { } // tag::launch[] -bootRun { +tasks.named("bootRun") { optimizedLaunch = false } // end::launch[] -task optimizedLaunch { +tasks.register("optimizedLaunch") { doLast { println bootRun.optimizedLaunch } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-disable-optimized-launch.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-disable-optimized-launch.gradle.kts index d5e2e2451624..7efa52cd2a83 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-disable-optimized-launch.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-disable-optimized-launch.gradle.kts @@ -6,12 +6,12 @@ plugins { } // tag::launch[] -tasks.getByName("bootRun") { +tasks.named("bootRun") { isOptimizedLaunch = false } // end::launch[] -task("optimizedLaunch") { +tasks.register("optimizedLaunch") { doLast { println(tasks.getByName("bootRun").isOptimizedLaunch) } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-main.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-main.gradle index 6c012eb2cf5d..292a53689777 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-main.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-main.gradle @@ -4,12 +4,12 @@ plugins { } // tag::main[] -bootRun { +tasks.named("bootRun") { mainClass = 'com.example.ExampleApplication' } // end::main[] -task configuredMainClass { +tasks.register("configuredMainClass") { doLast { println bootRun.mainClass } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-main.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-main.gradle.kts index 68e946a3e5ce..2639f88e38b0 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-main.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-main.gradle.kts @@ -6,12 +6,12 @@ plugins { } // tag::main[] -tasks.getByName("bootRun") { +tasks.named("bootRun") { mainClass.set("com.example.ExampleApplication") } // end::main[] -task("configuredMainClass") { +tasks.register("configuredMainClass") { doLast { println(tasks.getByName("bootRun").mainClass) } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-source-resources.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-source-resources.gradle index 4fcb59a01ac1..e09dac63f809 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-source-resources.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-source-resources.gradle @@ -4,12 +4,12 @@ plugins { } // tag::source-resources[] -bootRun { +tasks.named("bootRun") { sourceResources sourceSets.main } // end::source-resources[] -task configuredClasspath { +tasks.register("configuredClasspath") { doLast { println bootRun.classpath.files } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-source-resources.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-source-resources.gradle.kts index fed809bfe1b4..73a907b4f35c 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-source-resources.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-source-resources.gradle.kts @@ -6,12 +6,12 @@ plugins { } // tag::source-resources[] -tasks.getByName("bootRun") { +tasks.named("bootRun") { sourceResources(sourceSets["main"]) } // end::source-resources[] -task("configuredClasspath") { +tasks.register("configuredClasspath") { doLast { println(tasks.getByName("bootRun").classpath.files) } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-system-property.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-system-property.gradle index ec02477d9b35..34e44d56469f 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-system-property.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-system-property.gradle @@ -4,12 +4,12 @@ plugins { } // tag::system-property[] -bootRun { +tasks.named("bootRun") { systemProperty 'com.example.property', findProperty('example') ?: 'default' } // end::system-property[] -task configuredSystemProperties { +tasks.register("configuredSystemProperties") { doLast { bootRun.systemProperties.each { k, v -> println "$k = $v" diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-system-property.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-system-property.gradle.kts index a15e436ef4cf..71aab129cde3 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-system-property.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/running/boot-run-system-property.gradle.kts @@ -6,14 +6,14 @@ plugins { } // tag::system-property[] -tasks.getByName("bootRun") { +tasks.named("bootRun") { systemProperty("com.example.property", findProperty("example") ?: "default") } // end::system-property[] -task("configuredSystemProperties") { +tasks.register("configuredSystemProperties") { doLast { - tasks.getByName("bootRun").systemProperties.forEach { k, v -> + tasks.getByName("bootRun").systemProperties.forEach { k, v -> println("$k = $v") } }