From f5b536164cbde7b291c76a243335c4a8682e952f Mon Sep 17 00:00:00 2001 From: Caleb Cushing Date: Thu, 8 Apr 2021 18:04:24 -0500 Subject: [PATCH] Document use of module replacements to swap dependencies See gh-25944 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 ea122ad16e..d7ebab2998 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 @@ -1460,21 +1460,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") + } + } } ----