Skip to content

Commit 88910d6

Browse files
Publish temporal-spring-ai from the JDK 11 release job via toolchains
The module was previously excluded from the build whenever Gradle ran on JDK <17, which silently dropped it from the release and snapshot publish jobs (both use JDK 11). Switch to the same pattern temporal-sdk already uses: resolve a JDK 17+ compiler/javadoc/launcher via Gradle toolchains when the running JVM is older, and drop the conditional include guards in settings.gradle and the BOM so the artifact always publishes. Shared javadoc config in gradle/java.gradle now keys flag choices off the javadoc tool's language version instead of JavaVersion.current(), so modules that override javadocTool (temporal-spring-ai on JDK 11) don't get JDK 9-12-only flags passed to a JDK 17 tool. Add JDK 17 alongside JDK 11 in the publish workflows so toolchain discovery has a matching installation to resolve. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent bbcb85e commit 88910d6

File tree

6 files changed

+54
-21
lines changed

6 files changed

+54
-21
lines changed

.github/workflows/prepare-release.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ jobs:
9494
- name: Set up Java
9595
uses: actions/setup-java@v5
9696
with:
97-
java-version: "11"
97+
# JDK 17 is required for temporal-spring-ai's Gradle toolchain (Spring AI requires Java 17+).
98+
# The primary publish JVM remains JDK 11 (listed last so it's the default JAVA_HOME).
99+
java-version: |
100+
17
101+
11
98102
distribution: "temurin"
99103

100104
- name: Set up Gradle

.github/workflows/publish-snapshot.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ jobs:
3838
- name: Set up Java
3939
uses: actions/setup-java@v5
4040
with:
41-
java-version: '11'
41+
# JDK 17 is required for temporal-spring-ai's Gradle toolchain (Spring AI requires Java 17+).
42+
# The primary publish JVM remains JDK 11 (listed last so it's the default JAVA_HOME).
43+
java-version: |
44+
17
45+
11
4246
distribution: 'temurin'
4347

4448
- name: Set up Gradle

gradle/java.gradle

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,19 @@ subprojects {
3434
options.encoding = 'UTF-8'
3535
options.addStringOption('Xdoclint:reference', '-quiet')
3636
options.addBooleanOption('Werror', true)
37-
if (JavaVersion.current().isJava9Compatible()) {
38-
options.addBooleanOption('html5', true)
39-
}
40-
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_1_9) &&
41-
!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_13)) {
42-
//https://stackoverflow.com/questions/53732632/gradle-javadoc-search-redirects-to-undefined-url
43-
//the flag is removed in java13: https://bugs.openjdk.java.net/browse/JDK-8215582
44-
options.addBooleanOption('-no-module-directories', true)
37+
// Base flag decisions on the javadoc tool that will actually run, not the Gradle JVM.
38+
// Modules that override javadocTool via toolchains (e.g. temporal-spring-ai on JDK 11)
39+
// would otherwise get flags that don't apply to the tool being invoked.
40+
doFirst {
41+
int toolVersion = javadocTool.get().metadata.languageVersion.asInt()
42+
if (toolVersion >= 9) {
43+
options.addBooleanOption('html5', true)
44+
}
45+
if (toolVersion >= 9 && toolVersion < 13) {
46+
//https://stackoverflow.com/questions/53732632/gradle-javadoc-search-redirects-to-undefined-url
47+
//the flag is removed in java13: https://bugs.openjdk.java.net/browse/JDK-8215582
48+
options.addBooleanOption('-no-module-directories', true)
49+
}
4550
}
4651
}
4752

settings.gradle

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ include 'temporal-testing'
66
include 'temporal-test-server'
77
include 'temporal-opentracing'
88
include 'temporal-kotlin'
9-
// temporal-spring-ai requires Java 17+ (Spring AI dependency).
10-
// Exclude from builds running on older JDKs.
11-
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
12-
include 'temporal-spring-ai'
13-
}
9+
include 'temporal-spring-ai'
1410
include 'temporal-spring-boot-autoconfigure'
1511
include 'temporal-spring-boot-starter'
1612
include 'temporal-remote-data-encoder'

temporal-bom/build.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ dependencies {
1212
api project(':temporal-sdk')
1313
api project(':temporal-serviceclient')
1414
api project(':temporal-shaded')
15-
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
16-
api project(':temporal-spring-ai')
17-
}
15+
api project(':temporal-spring-ai')
1816
api project(':temporal-spring-boot-autoconfigure')
1917
api project(':temporal-spring-boot-starter')
2018
api project(':temporal-test-server')

temporal-spring-ai/build.gradle

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,43 @@ ext {
1010
// When edgeDepsTest is set, use 21 to match other modules (avoids Gradle JVM compatibility rejection).
1111
ext {
1212
springAiJavaVersion = project.hasProperty("edgeDepsTest") ? JavaVersion.VERSION_21 : JavaVersion.VERSION_17
13-
springAiRelease = project.hasProperty("edgeDepsTest") ? '21' : '17'
13+
springAiReleaseInt = project.hasProperty("edgeDepsTest") ? 21 : 17
1414
}
1515

1616
java {
1717
sourceCompatibility = springAiJavaVersion
1818
targetCompatibility = springAiJavaVersion
1919
}
2020

21+
// Use a JDK 17+ compiler/javadoc/launcher via Gradle toolchains when the running JVM is older.
22+
// This lets the module build and publish from the same JDK 11 release job used for the rest of
23+
// the SDK, matching the pattern used by temporal-sdk for its Java 17/21 source sets.
2124
compileJava {
25+
if (!JavaVersion.current().isCompatibleWith(springAiJavaVersion)) {
26+
javaCompiler = javaToolchains.compilerFor {
27+
languageVersion = JavaLanguageVersion.of(springAiReleaseInt)
28+
}
29+
}
2230
options.compilerArgs.removeAll(['--release', '8'])
23-
options.compilerArgs.addAll(['--release', springAiRelease])
31+
options.release = springAiReleaseInt
2432
}
2533

2634
compileTestJava {
35+
if (!JavaVersion.current().isCompatibleWith(springAiJavaVersion)) {
36+
javaCompiler = javaToolchains.compilerFor {
37+
languageVersion = JavaLanguageVersion.of(springAiReleaseInt)
38+
}
39+
}
2740
options.compilerArgs.removeAll(['--release', '8'])
28-
options.compilerArgs.addAll(['--release', springAiRelease])
41+
options.release = springAiReleaseInt
42+
}
43+
44+
javadoc {
45+
if (!JavaVersion.current().isCompatibleWith(springAiJavaVersion)) {
46+
javadocTool = javaToolchains.javadocToolFor {
47+
languageVersion = JavaLanguageVersion.of(springAiReleaseInt)
48+
}
49+
}
2950
}
3051

3152
dependencies {
@@ -59,4 +80,9 @@ dependencies {
5980

6081
tasks.test {
6182
useJUnitPlatform()
83+
if (!JavaVersion.current().isCompatibleWith(springAiJavaVersion)) {
84+
javaLauncher = javaToolchains.launcherFor {
85+
languageVersion = JavaLanguageVersion.of(springAiReleaseInt)
86+
}
87+
}
6288
}

0 commit comments

Comments
 (0)