@@ -114,6 +114,9 @@ if (latestDepTest) {
114
114
}
115
115
}
116
116
117
+ val testJavaVersion = gradle.startParameter.projectProperties[" testJavaVersion" ]?.let (JavaVersion ::toVersion)
118
+ val testSpring3 = (testJavaVersion == null || testJavaVersion.compareTo(JavaVersion .VERSION_17 ) >= 0 )
119
+
117
120
testing {
118
121
suites {
119
122
val testLogbackAppender by registering(JvmTestSuite ::class ) {
@@ -153,16 +156,18 @@ testing {
153
156
}
154
157
}
155
158
156
- val testSpring3 by registering(JvmTestSuite ::class ) {
157
- dependencies {
158
- implementation(project())
159
- implementation(" org.springframework.boot:spring-boot-starter-web:3.2.4" )
160
- implementation(" io.opentelemetry:opentelemetry-sdk-extension-autoconfigure" )
161
- implementation(project(" :instrumentation:spring:spring-web:spring-web-3.1:library" ))
162
- implementation(project(" :instrumentation:spring:spring-webmvc:spring-webmvc-6.0:library" ))
163
- implementation(" jakarta.servlet:jakarta.servlet-api:5.0.0" )
164
- implementation(" org.springframework.boot:spring-boot-starter-test:3.2.4" ) {
165
- exclude(" org.junit.vintage" , " junit-vintage-engine" )
159
+ if (testSpring3) {
160
+ val testSpring3 by registering(JvmTestSuite ::class ) {
161
+ dependencies {
162
+ implementation(project())
163
+ implementation(" org.springframework.boot:spring-boot-starter-web:3.2.4" )
164
+ implementation(" io.opentelemetry:opentelemetry-sdk-extension-autoconfigure" )
165
+ implementation(project(" :instrumentation:spring:spring-web:spring-web-3.1:library" ))
166
+ implementation(project(" :instrumentation:spring:spring-webmvc:spring-webmvc-6.0:library" ))
167
+ implementation(" jakarta.servlet:jakarta.servlet-api:5.0.0" )
168
+ implementation(" org.springframework.boot:spring-boot-starter-test:3.2.4" ) {
169
+ exclude(" org.junit.vintage" , " junit-vintage-engine" )
170
+ }
166
171
}
167
172
}
168
173
}
@@ -198,10 +203,12 @@ tasks {
198
203
options.release.set(17 )
199
204
}
200
205
201
- named<JavaCompile >(" compileTestSpring3Java" ) {
202
- sourceCompatibility = " 17"
203
- targetCompatibility = " 17"
204
- options.release.set(17 )
206
+ if (testSpring3) {
207
+ named<JavaCompile >(" compileTestSpring3Java" ) {
208
+ sourceCompatibility = " 17"
209
+ targetCompatibility = " 17"
210
+ options.release.set(17 )
211
+ }
205
212
}
206
213
207
214
withType(Jar ::class ) {
0 commit comments