You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "Ruobing1997 (via GitHub)" <gi...@apache.org> on 2026/10/07 23:03:56 UTC

[PR] Fix build on JDK 22+: pin polaris-server-test-runner to Java 21 bytecode [polaris]

Ruobing1997 opened a new pull request, #5737:
URL: https://github.com/apache/polaris/pull/5737

   README and CONTRIBUTING state that the build requires Java 21 or later, but `./gradlew compileAll` fails when Gradle runs on a newer JDK (reproduced on JDK 25 at current `main`):
   
   ```
   Could not resolve org.apache.polaris.server-test-runner:polaris-server-test-runner.
     Required by: project ':polaris-extensions-auth-opa'
     > Dependency resolution is looking for a library compatible with JVM runtime version 21,
       but 'project ':polaris-server-test-runner'' is only compatible with JVM runtime version 25 or newer.
   ```
   
   **Cause**
   
   The `gradle/server-test-runner` included build (added in #4732) does not set a bytecode target, so it is compiled for whatever JVM runs Gradle. Most included build plugins are only loaded into the Gradle daemon, where this doesn't matter. But `extensions/auth/opa` also consumes this one as a library from its `opaStartupAction` source set, which uses the `polaris-server` convention (`options.release = 21`). Gradle's variant matching then rejects the runner's newer-bytecode variant. CI only runs on JDK 21, which is why this was not caught.
   
   **Change**
   
   Pin the runner's Java and Kotlin compilation to 21. This matches the minimum Java version enforced in the root `settings.gradle.kts` and the `polaris-server` convention. Kotlin's `jvmTarget` is set as well, because the Kotlin Gradle plugin requires it to match the Java target.
   
   Note: the minimum Java version is now hard-coded in three places (`settings.gradle.kts`, `polaris-server.gradle.kts`, and here). Consolidating it into a single source of truth could be a follow-up if maintainers want it.
   
   **Testing**
   
   - JDK 25: `./gradlew format compileAll` and `./gradlew :polaris-server-test-runner:check` pass. Runner classes now have major version 65 (Java 21).
   - JDK 21: `./gradlew :polaris-server-test-runner:check` passes. Full JDK 21 coverage comes from CI.
   
   This is a build-only change with no user-facing behavior, so `CHANGELOG.md` is not updated.
   
   This is about *building* on newer JDKs. Running the server on JDK 25 is tracked separately in #2991.
   
   ## Checklist
   - [x] ๐Ÿ›ก๏ธ Don't disclose security issues! (contact security@apache.org)
   - [x] ๐Ÿ”— Clearly explained why the changes are needed, or linked related issues: Fixes #
   - [x] ๐Ÿงช Added/updated tests with good coverage, or manually tested (and explained how)
   - [x] ๐Ÿ’ก Added comments for complex logic
   - [ ] ๐Ÿงพ Updated `CHANGELOG.md` (if needed) โ€” not needed, build-only change
   - [ ] ๐Ÿ“š Updated documentation in `site/content/in-dev/unreleased` (if needed) โ€” not needed
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix build on JDK 22+: pin polaris-server-test-runner to Java 21 bytecode [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b merged PR #5737:
URL: https://github.com/apache/polaris/pull/5737


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix build on JDK 22+: pin polaris-server-test-runner to Java 21 bytecode [polaris]

Posted by "Ruobing1997 (via GitHub)" <gi...@apache.org>.
Ruobing1997 commented on code in PR #5737:
URL: https://github.com/apache/polaris/pull/5737#discussion_r4214414638


##########
gradle/server-test-runner/build.gradle.kts:
##########
@@ -41,3 +43,8 @@ dependencies {
 }
 
 group = "org.apache.polaris.server-test-runner"
+
+// Keep in sync with the minimum Java version in the root settings.gradle.kts
+tasks.withType<JavaCompile>().configureEach { options.release = 21 }

Review Comment:
   Thanks for the quick review, @dimas-b!
   
   I considered that, but I'm not sure it's a good fit here. 
   In #4732 @snazy [mentioned](https://github.com/apache/polaris/pull/4732#discussion_r3442049068) keeping this plugin outside build-logic deliberately, to avoid polluting the build-script classpath and to keep it testable standalone.
   
   So I went with the minimal fix of pinning the target to 21. 
   
   But I am more than happy to change the approach if you and @snazy prefer!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix build on JDK 22+: pin polaris-server-test-runner to Java 21 bytecode [polaris]

Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy commented on code in PR #5737:
URL: https://github.com/apache/polaris/pull/5737#discussion_r4215660963


##########
gradle/server-test-runner/build.gradle.kts:
##########
@@ -41,3 +43,8 @@ dependencies {
 }
 
 group = "org.apache.polaris.server-test-runner"
+
+// Keep in sync with the minimum Java version in the root settings.gradle.kts
+tasks.withType<JavaCompile>().configureEach { options.release = 21 }

Review Comment:
   That change LGTM, and is correct.
   `server-test-runner` doesn't even "see" the Polaris build-logic.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix build on JDK 22+: pin polaris-server-test-runner to Java 21 bytecode [polaris]

Posted by "Ruobing1997 (via GitHub)" <gi...@apache.org>.
Ruobing1997 commented on PR #5737:
URL: https://github.com/apache/polaris/pull/5737#issuecomment-6048706918

   Hi @snazy, Sorry for the direct ping, since this touches the server-test-runner build you added in #4732, would you mind taking a look when you have a chance? No rush at all! Thank you so much for your patience and effort!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix build on JDK 22+: pin polaris-server-test-runner to Java 21 bytecode [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #5737:
URL: https://github.com/apache/polaris/pull/5737#discussion_r4213239109


##########
gradle/server-test-runner/build.gradle.kts:
##########
@@ -41,3 +43,8 @@ dependencies {
 }
 
 group = "org.apache.polaris.server-test-runner"
+
+// Keep in sync with the minimum Java version in the root settings.gradle.kts
+tasks.withType<JavaCompile>().configureEach { options.release = 21 }

Review Comment:
   Should we include the `polaris-server` plugin instead?
   
   https://github.com/apache/polaris/blob/9377aa731a64d6262dc7cc177d8a457d14c46f0a/build-logic/src/main/kotlin/polaris-server.gradle.kts#L24



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix build on JDK 22+: pin polaris-server-test-runner to Java 21 bytecode [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #5737:
URL: https://github.com/apache/polaris/pull/5737#discussion_r4213239109


##########
gradle/server-test-runner/build.gradle.kts:
##########
@@ -41,3 +43,8 @@ dependencies {
 }
 
 group = "org.apache.polaris.server-test-runner"
+
+// Keep in sync with the minimum Java version in the root settings.gradle.kts
+tasks.withType<JavaCompile>().configureEach { options.release = 21 }

Review Comment:
   Should we include this plugin instead?
   
   https://github.com/apache/polaris/blob/9377aa731a64d6262dc7cc177d8a457d14c46f0a/build-logic/src/main/kotlin/polaris-server.gradle.kts#L24



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org