Skip to content

Commit 61dff17

Browse files
committed
Adapt boot2-test for Gradle 9 compatiblity
Normally, the Spring Boot 2 Gradle Plugin would not be compatible with Gradle 9+ To get around this issue, we use the dependency-management plugin in isolation as described here: https://docs.spring.io/spring-boot/docs/2.7.7/gradle-plugin/reference/htmlsingle/#managing-dependencies.dependency-management-plugin.using-in-isolation This way, we get proper test execution and realistic version resolution on Gradle 9
1 parent 61953bd commit 61dff17

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

settings.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ if (javaVersion == 8) {
114114
include "spock-unitils"
115115

116116
if (javaVersion <= 17) {
117-
// include "spock-spring:boot2-test" TODO adapt this according to the outstanding discussion
118-
// https://github.com/spockframework/spock/discussions/2200
117+
include "spock-spring:boot2-test"
119118
}
120119
include "spock-spring:spring3-test"
121120
include "spock-spring:spring5-test"

spock-spring/boot2-test/boot2-test.gradle

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.springframework.boot.gradle.plugin.SpringBootPlugin
2+
13
/*
24
* Copyright 2018 the original author or authors.
35
*
@@ -15,8 +17,18 @@
1517
*/
1618

1719
plugins {
20+
// Normally, the Spring Boot 2 Gradle Plugin would not be compatible with Gradle 9+
21+
// To get around this issue, we use the dependency-management plugin in isolation
22+
// as described here: https://docs.spring.io/spring-boot/docs/2.7.7/gradle-plugin/reference/htmlsingle/#managing-dependencies.dependency-management-plugin.using-in-isolation
23+
// This way, we get proper test execution and realistic version resolution on Gradle 9
24+
id 'org.springframework.boot' version "2.7.18" apply false
1825
id "io.spring.dependency-management" version "1.1.7"
19-
id 'org.springframework.boot' version "2.7.18"
26+
}
27+
28+
dependencyManagement {
29+
imports {
30+
mavenBom SpringBootPlugin.BOM_COORDINATES
31+
}
2032
}
2133

2234
// Spring dependency management downgrades the jupiter version to 5.7.2 otherwise

0 commit comments

Comments
 (0)