@@ -24,6 +24,11 @@ dependencies {
2424 exclude group : ' org.slf4j' , module : ' slf4j-api'
2525 }
2626
27+ // The Java 8 stub of Jackson3JsonPayloadConverter must declare the same public API as the
28+ // Java 17 class (JEP 238), so the Jackson 3 types are needed at compile time only. The java17
29+ // source set sees them through the main compile classpath.
30+ compileOnly " tools.jackson.core:jackson-databind:$jackson3Version "
31+
2732 testImplementation project(' :temporal-testing' )
2833 // The optional envconfig-backed test harness is loaded only while SDK tests are running.
2934 testRuntimeOnly project(' :temporal-envconfig' )
@@ -62,7 +67,6 @@ dependencies {
6267 // project's JVM compatibility (e.g. 21+ on CI edge runners).
6368 java17Implementation files(sourceSets. main. output. classesDirs) { builtBy compileJava }
6469 java17Implementation files({ sourceSets. main. compileClasspath })
65- java17CompileOnly " tools.jackson.core:jackson-databind:$jackson3Version "
6670
6771 java21Implementation files(sourceSets. main. output. classesDirs) { builtBy compileJava }
6872}
@@ -202,9 +206,8 @@ task testCloud(type: Test) {
202206}
203207
204208// On Java 17+, prepend java17 classes to all test classpaths so that Class.forName finds
205- // the real Jackson3JsonPayloadConverter instead of the Java 8 stub. This lets us test
206- // the present-java17-but-absent-jackson3 behavior (NoClassDefFoundError) in the same
207- // test that tests the Java 8 stub behavior (UnsupportedOperationException).
209+ // the real Jackson3JsonPayloadConverter instead of the Java 8 stub, matching what the
210+ // multi-release jar resolves to at runtime.
208211tasks. withType(Test ). configureEach {
209212 dependsOn compileJava17Java
210213 doFirst {
@@ -257,9 +260,8 @@ testing {
257260 jackson3Tests(JvmTestSuite ) {
258261 dependencies {
259262 // java17 output must come before project() (added by configureEach) so that
260- // the compiler and runtime see the real Jackson3JsonPayloadConverter — which
261- // has a wider API than the Java 8 stub (newDefaultJsonMapper, JsonMapper
262- // constructor) because the stub can't reference Jackson 3 types.
263+ // the compiler and runtime see the real Jackson3JsonPayloadConverter rather
264+ // than the Java 8 stub, which only throws.
263265 implementation files(sourceSets. java17. output. classesDirs) { builtBy compileJava17Java }
264266 implementation " tools.jackson.core:jackson-databind:$jackson3Version "
265267 }
@@ -271,6 +273,7 @@ testing {
271273 languageVersion = JavaLanguageVersion . of(project. property(" testJavaVersion" ) as int )
272274 }
273275 }
276+ systemProperty ' temporal.sdk.mainClassesDirs' , sourceSets. main. output. classesDirs. asPath
274277 shouldRunAfter(test)
275278 }
276279 }
0 commit comments