Remove non-transitive dependencies from spring-boot-starter-test

transitive = false maps to a wildcard exclusion in the published pom.
Unfortunately, this causes problems with Maven as any dependency
on one of the transitive = false modules then has all of its
dependencies excluded, even when it appears elsewhere in the
dependency graph without any exclusions.

Gradle is not affected as it requires an exclusion to be declared
on every route to a dependency for it to be effective. Maven is
affected as it requires the exclusion to be present on only one
route.
This commit is contained in:
Andy Wilkinson 2025-07-24 09:57:35 +01:00
parent 84712fa6d1
commit 96ff9e59ad
40 changed files with 40 additions and 13 deletions

View File

@ -26,6 +26,7 @@ dependencies {
implementation(project(":starter:spring-boot-starter-security")) implementation(project(":starter:spring-boot-starter-security"))
implementation(project(":starter:spring-boot-starter-webmvc")) implementation(project(":starter:spring-boot-starter-webmvc"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
testRuntimeOnly("org.apache.httpcomponents.client5:httpclient5") testRuntimeOnly("org.apache.httpcomponents.client5:httpclient5")

View File

@ -24,5 +24,6 @@ dependencies {
implementation(project(":starter:spring-boot-starter-actuator")) implementation(project(":starter:spring-boot-starter-actuator"))
implementation(project(":starter:spring-boot-starter-webmvc")) implementation(project(":starter:spring-boot-starter-webmvc"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
} }

View File

@ -26,5 +26,6 @@ dependencies {
implementation(project(":starter:spring-boot-starter-security")) implementation(project(":starter:spring-boot-starter-security"))
implementation(project(":starter:spring-boot-starter-webmvc")) implementation(project(":starter:spring-boot-starter-webmvc"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
} }

View File

@ -30,6 +30,7 @@ dependencies {
runtimeOnly("com.h2database:h2") runtimeOnly("com.h2database:h2")
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
testRuntimeOnly("org.apache.httpcomponents.client5:httpclient5") testRuntimeOnly("org.apache.httpcomponents.client5:httpclient5")
} }

View File

@ -30,5 +30,6 @@ dependencies {
implementation(project(":starter:spring-boot-starter-webmvc")) implementation(project(":starter:spring-boot-starter-webmvc"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
} }

View File

@ -23,5 +23,6 @@ description = "Spring Boot HATEOAS smoke test"
dependencies { dependencies {
implementation(project(":starter:spring-boot-starter-hateoas")) implementation(project(":starter:spring-boot-starter-hateoas"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
} }

View File

@ -27,5 +27,6 @@ dependencies {
runtimeOnly("jakarta.xml.bind:jakarta.xml.bind-api") runtimeOnly("jakarta.xml.bind:jakarta.xml.bind-api")
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
} }

View File

@ -37,6 +37,7 @@ dependencies {
runtimeOnly("org.glassfish.web:jakarta.servlet.jsp.jstl") runtimeOnly("org.glassfish.web:jakarta.servlet.jsp.jstl")
testImplementation(project(":starter:spring-boot-starter-test"))
testImplementation(project(":starter:spring-boot-starter-jetty")) testImplementation(project(":starter:spring-boot-starter-jetty"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test"))
} }

View File

@ -26,6 +26,7 @@ dependencies {
exclude module: "spring-boot-starter-tomcat" exclude module: "spring-boot-starter-tomcat"
} }
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
testRuntimeOnly("org.apache.httpcomponents.client5:httpclient5") testRuntimeOnly("org.apache.httpcomponents.client5:httpclient5")

View File

@ -26,5 +26,6 @@ dependencies {
} }
implementation(project(":starter:spring-boot-starter-jetty")) implementation(project(":starter:spring-boot-starter-jetty"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
} }

View File

@ -23,6 +23,7 @@ description = "Spring Boot OAuth2 Authorization Server smoke test"
dependencies { dependencies {
implementation(project(":starter:spring-boot-starter-security-oauth2-authorization-server")) implementation(project(":starter:spring-boot-starter-security-oauth2-authorization-server"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
testImplementation("org.apache.httpcomponents.client5:httpclient5") testImplementation("org.apache.httpcomponents.client5:httpclient5")
} }

View File

@ -24,6 +24,7 @@ dependencies {
implementation(project(":starter:spring-boot-starter-security-oauth2-client")) implementation(project(":starter:spring-boot-starter-security-oauth2-client"))
implementation(project(":starter:spring-boot-starter-webmvc")) implementation(project(":starter:spring-boot-starter-webmvc"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
testImplementation("org.apache.httpcomponents.client5:httpclient5") testImplementation("org.apache.httpcomponents.client5:httpclient5")
} }

View File

@ -24,6 +24,7 @@ dependencies {
implementation(project(":starter:spring-boot-starter-security-oauth2-resource-server")) implementation(project(":starter:spring-boot-starter-security-oauth2-resource-server"))
implementation(project(":starter:spring-boot-starter-webmvc")) implementation(project(":starter:spring-boot-starter-webmvc"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
testImplementation("com.squareup.okhttp3:mockwebserver") testImplementation("com.squareup.okhttp3:mockwebserver")
} }

View File

@ -27,5 +27,6 @@ dependencies {
runtimeOnly('io.micrometer:micrometer-registry-prometheus') runtimeOnly('io.micrometer:micrometer-registry-prometheus')
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
} }

View File

@ -28,6 +28,7 @@ dependencies {
runtimeOnly("com.h2database:h2") runtimeOnly("com.h2database:h2")
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
testImplementation("org.awaitility:awaitility") testImplementation("org.awaitility:awaitility")
} }

View File

@ -32,6 +32,7 @@ dependencies {
implementation(project(":starter:spring-boot-starter-security-saml2")) implementation(project(":starter:spring-boot-starter-security-saml2"))
implementation(project(":starter:spring-boot-starter-webmvc")) implementation(project(":starter:spring-boot-starter-webmvc"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
testImplementation("org.apache.httpcomponents.client5:httpclient5") testImplementation("org.apache.httpcomponents.client5:httpclient5")
} }

View File

@ -25,5 +25,6 @@ dependencies {
implementation(project(":starter:spring-boot-starter-jersey")) implementation(project(":starter:spring-boot-starter-jersey"))
implementation(project(":starter:spring-boot-starter-security")) implementation(project(":starter:spring-boot-starter-security"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
} }

View File

@ -25,6 +25,7 @@ dependencies {
implementation(project(":starter:spring-boot-starter-security")) implementation(project(":starter:spring-boot-starter-security"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
testRuntimeOnly(project(":starter:spring-boot-starter-tomcat")) testRuntimeOnly(project(":starter:spring-boot-starter-tomcat"))

View File

@ -26,5 +26,6 @@ dependencies {
implementation(project(":starter:spring-boot-starter-session-hazelcast")) implementation(project(":starter:spring-boot-starter-session-hazelcast"))
implementation(project(":starter:spring-boot-starter-webmvc")) implementation(project(":starter:spring-boot-starter-webmvc"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
} }

View File

@ -29,5 +29,6 @@ dependencies {
runtimeOnly(project(":starter:spring-boot-starter-jdbc")) runtimeOnly(project(":starter:spring-boot-starter-jdbc"))
runtimeOnly("com.h2database:h2") runtimeOnly("com.h2database:h2")
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
} }

View File

@ -33,5 +33,6 @@ dependencies {
providedRuntime("org.glassfish.web:jakarta.servlet.jsp.jstl") providedRuntime("org.glassfish.web:jakarta.servlet.jsp.jstl")
providedRuntime("org.apache.tomcat.embed:tomcat-embed-jasper") providedRuntime("org.apache.tomcat.embed:tomcat-embed-jasper")
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
} }

View File

@ -23,6 +23,7 @@ description = "Spring Boot Tomcat multi-connectors smoke test"
dependencies { dependencies {
implementation(project(":starter:spring-boot-starter-webmvc")) implementation(project(":starter:spring-boot-starter-webmvc"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
testImplementation("org.apache.httpcomponents.client5:httpclient5") testImplementation("org.apache.httpcomponents.client5:httpclient5")
} }

View File

@ -24,6 +24,7 @@ dependencies {
implementation(project(":starter:spring-boot-starter-webmvc")) implementation(project(":starter:spring-boot-starter-webmvc"))
implementation(project(":starter:spring-boot-starter-actuator")) implementation(project(":starter:spring-boot-starter-actuator"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
testImplementation("org.apache.httpcomponents.client5:httpclient5") testImplementation("org.apache.httpcomponents.client5:httpclient5")
} }

View File

@ -23,5 +23,6 @@ description = "Spring Boot Tomcat smoke test"
dependencies { dependencies {
implementation(project(":starter:spring-boot-starter-webmvc")) implementation(project(":starter:spring-boot-starter-webmvc"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
} }

View File

@ -33,6 +33,7 @@ dependencies {
providedRuntime(project(":starter:spring-boot-starter-tomcat")) providedRuntime(project(":starter:spring-boot-starter-tomcat"))
providedRuntime("org.apache.tomcat.embed:tomcat-embed-jasper") providedRuntime("org.apache.tomcat.embed:tomcat-embed-jasper")
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
testImplementation("org.apache.httpcomponents.client5:httpclient5") testImplementation("org.apache.httpcomponents.client5:httpclient5")
} }

View File

@ -26,6 +26,7 @@ dependencies {
} }
implementation(project(":starter:spring-boot-starter-undertow")) implementation(project(":starter:spring-boot-starter-undertow"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
testImplementation("org.apache.httpcomponents.client5:httpclient5") testImplementation("org.apache.httpcomponents.client5:httpclient5")
} }

View File

@ -26,5 +26,6 @@ dependencies {
} }
implementation(project(":starter:spring-boot-starter-undertow")) implementation(project(":starter:spring-boot-starter-undertow"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
} }

View File

@ -24,5 +24,6 @@ dependencies {
implementation(project(":starter:spring-boot-starter-freemarker")) implementation(project(":starter:spring-boot-starter-freemarker"))
implementation(project(":starter:spring-boot-starter-webmvc")) implementation(project(":starter:spring-boot-starter-webmvc"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
} }

View File

@ -26,5 +26,6 @@ dependencies {
implementation(project(":starter:spring-boot-starter-webmvc")) implementation(project(":starter:spring-boot-starter-webmvc"))
implementation("jakarta.xml.bind:jakarta.xml.bind-api") implementation("jakarta.xml.bind:jakarta.xml.bind-api")
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
} }

View File

@ -33,5 +33,6 @@ dependencies {
providedRuntime("org.glassfish.web:jakarta.servlet.jsp.jstl") providedRuntime("org.glassfish.web:jakarta.servlet.jsp.jstl")
providedRuntime("org.apache.tomcat.embed:tomcat-embed-jasper") providedRuntime("org.apache.tomcat.embed:tomcat-embed-jasper")
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
} }

View File

@ -25,5 +25,6 @@ dependencies {
implementation(project(":starter:spring-boot-starter-security")) implementation(project(":starter:spring-boot-starter-security"))
implementation(project(":starter:spring-boot-starter-webmvc")) implementation(project(":starter:spring-boot-starter-webmvc"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
} }

View File

@ -24,5 +24,6 @@ dependencies {
implementation(project(":starter:spring-boot-starter-mustache")) implementation(project(":starter:spring-boot-starter-mustache"))
implementation(project(":starter:spring-boot-starter-webmvc")) implementation(project(":starter:spring-boot-starter-webmvc"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
} }

View File

@ -24,6 +24,7 @@ dependencies {
implementation(project(":starter:spring-boot-starter-security")) implementation(project(":starter:spring-boot-starter-security"))
implementation(project(":starter:spring-boot-starter-webmvc")) implementation(project(":starter:spring-boot-starter-webmvc"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
testImplementation("org.apache.httpcomponents.client5:httpclient5") testImplementation("org.apache.httpcomponents.client5:httpclient5")
} }

View File

@ -27,6 +27,7 @@ dependencies {
runtimeOnly("com.h2database:h2") runtimeOnly("com.h2database:h2")
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
testImplementation("org.apache.httpcomponents.client5:httpclient5") testImplementation("org.apache.httpcomponents.client5:httpclient5")
} }

View File

@ -24,6 +24,7 @@ dependencies {
implementation(project(":starter:spring-boot-starter-security")) implementation(project(":starter:spring-boot-starter-security"))
implementation(project(":starter:spring-boot-starter-webmvc")) implementation(project(":starter:spring-boot-starter-webmvc"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
testImplementation("org.apache.httpcomponents.client5:httpclient5") testImplementation("org.apache.httpcomponents.client5:httpclient5")
} }

View File

@ -34,5 +34,6 @@ dependencies {
runtimeOnly("org.webjars:bootstrap:3.0.3") runtimeOnly("org.webjars:bootstrap:3.0.3")
runtimeOnly("org.webjars:jquery:2.0.3-1") runtimeOnly("org.webjars:jquery:2.0.3-1")
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
} }

View File

@ -25,5 +25,6 @@ dependencies {
implementation(project(":starter:spring-boot-starter-webmvc")) implementation(project(":starter:spring-boot-starter-webmvc"))
implementation(project(":starter:spring-boot-starter-validation")) implementation(project(":starter:spring-boot-starter-validation"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
} }

View File

@ -24,6 +24,7 @@ dependencies {
implementation(project(":starter:spring-boot-starter-actuator")) implementation(project(":starter:spring-boot-starter-actuator"))
implementation(project(":starter:spring-boot-starter-webflux")) implementation(project(":starter:spring-boot-starter-webflux"))
testImplementation(project(":starter:spring-boot-starter-restclient"))
testImplementation(project(":starter:spring-boot-starter-test")) testImplementation(project(":starter:spring-boot-starter-test"))
testImplementation("io.projectreactor:reactor-test") testImplementation("io.projectreactor:reactor-test")
} }

View File

@ -25,21 +25,9 @@ dependencies {
api(project(":core:spring-boot-test")) api(project(":core:spring-boot-test"))
api(project(":module:spring-boot-http-client")) {
transitive = false
}
api(project(":module:spring-boot-http-codec")) {
transitive = false
}
api(project(":module:spring-boot-restclient")) {
transitive = false
}
api(project(":module:spring-boot-restclient-test")) api(project(":module:spring-boot-restclient-test"))
api(project(":module:spring-boot-test-autoconfigure")) api(project(":module:spring-boot-test-autoconfigure"))
api(project(":module:spring-boot-web-server-test")) api(project(":module:spring-boot-web-server-test"))
api(project(":module:spring-boot-webclient")) {
transitive = false
}
api("com.jayway.jsonpath:json-path") api("com.jayway.jsonpath:json-path")
api("jakarta.xml.bind:jakarta.xml.bind-api") api("jakarta.xml.bind:jakarta.xml.bind-api")

View File

@ -41,6 +41,7 @@ dependencies {
implementation(project(":starter:spring-boot-starter-actuator")) implementation(project(":starter:spring-boot-starter-actuator"))
systemTestImplementation(enforcedPlatform(project(path: ":platform:spring-boot-internal-dependencies"))) systemTestImplementation(enforcedPlatform(project(path: ":platform:spring-boot-internal-dependencies")))
systemTestImplementation(project(":starter:spring-boot-starter-restclient"))
systemTestImplementation(project(":starter:spring-boot-starter-test")) systemTestImplementation(project(":starter:spring-boot-starter-test"))
systemTestImplementation(project(":test-support:spring-boot-test-support")) systemTestImplementation(project(":test-support:spring-boot-test-support"))
systemTestImplementation("org.apache.httpcomponents.client5:httpclient5") systemTestImplementation("org.apache.httpcomponents.client5:httpclient5")