From 040d954281732115279953b9c1703279e655d723 Mon Sep 17 00:00:00 2001 From: Caleb Cushing Date: Thu, 8 Apr 2021 18:04:24 -0500 Subject: [PATCH] use modern DSL as described in the gradle docs Signed-off-by: Caleb Cushing --- .../src/docs/asciidoc/howto.adoc | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto.adoc index ee73c11823c1..5bf6d3999ab0 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto.adoc @@ -1493,21 +1493,16 @@ The following example shows how to set up the starters in Maven: ---- -And the following example shows one way to set up the starters in Gradle: +And the following example shows one way to set up the starters in https://docs.gradle.org/current/userguide/resolution_rules.html#sec:module_replacement[Gradle]: [source,groovy,indent=0,subs="verbatim,quotes,attributes"] ---- - dependencies { - compile 'org.springframework.boot:spring-boot-starter-web' - } - - configurations.all { - resolutionStrategy.dependencySubstitution.all { dependency -> - if (dependency.requested instanceof ModuleComponentSelector && dependency.requested.module == 'spring-boot-starter-logging') { - dependency.useTarget("org.springframework.boot:spring-boot-starter-log4j2:$dependency.requested.version", 'Use Log4j2 instead of Logback') - } - } - } +dependencies { + modules { + module("org.springframework.boot:spring-boot-starter-logging") { + replacedBy("org.springframework.boot:spring-boot-starter-log4j2") + } + } } ----