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 f395172ce5..754080730e 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 0e0dc5388f..a8359facf4 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 50ca6e1b7d..520787b2ed 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 c180ca27ff..23aa9bd010 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 c1f5c6745e..ab0293db49 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 9df9bd72bd..2de3229272 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 4ebde0a949..4e917c2e3f 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 a218863cf1..44a7c26b2a 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 955cd8993b..a51c09bd98 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 7745b7d59a..737fe63b37 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 890f838ceb..8ee8a2d67d 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 5adeb830b2..3b72699745 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 84a3b105ae..71922f4490 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 723790814c..bf265f8b5c 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 1220d6f4f0..3b0c454d7f 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 a98d23ebfa..9140d8182d 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 a9a7e9bc29..71d3948193 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 488e56830d..9613fe8c05 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 c1893e37d9..1eaa8d03d7 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 e7f21592b7..d043937d0c 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 48e140a6aa..f3603a4405 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 ea425c77ea..6c6d114230 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 2939641c41..024266d701 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 cc571d2c6a..f54362da9c 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 d97dcc95c9..da6918c076 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 210debdad7..a3e15f1f5e 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 43bba7349d..c1f3d348a8 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 24c44610c2..7ffdf42e4f 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 68c8f07998..6f1df662be 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 992e8ac3eb..b3e4206ca9 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 2e89d34090..ba0dde4dc0 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 6ec2cadf76..851ee90179 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 3f660bca42..3ea9a62772 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 ae8f6c185e..9ced3e7138 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 0ba07ac60d..7175092af8 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 5529523668..bababaa61b 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 6a548bd3d5..55b9de16f3 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 64f87c333f..48aea9b011 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 766fa759e8..f384d8e6a6 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 d26c9f5cda..a79bc048cb 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 ec798043d3..3274bdb594 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 e88d8f3d82..4f68e068e6 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 4efea4455d..1f12601ca7 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 5af9e5d81a..c151efe9e5 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 3c1bf08c1d..2872469f60 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 8873f0a38b..19d723b795 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 6f8ef2b67c..748aa957f3 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 2e6686bfb0..c15f189fdc 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 610ceb0a0c..418c5f101f 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 cc6df0ffa4..f11d2344cf 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 6f5714457b..f568417d88 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 680605a126..7bb2c90437 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 4b95b69db9..e1529d17cf 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 d5e2e24516..7efa52cd2a 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 6c012eb2cf..292a536897 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 68e946a3e5..2639f88e38 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 4fcb59a01a..e09dac63f8 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 fed809bfe1..73a907b4f3 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 ec02477d9b..34e44d5646 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 a15e436ef4..71aab129cd 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") } }