Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#1373] fix: Fix UT hang with OpenJDK 17 on MacOSX (#1586)

Qi Yu5854e3eae35f
diff --git a/build.gradle.kts b/build.gradle.kts
index 1bfe647e28..754e535ac6 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -11,6 +11,7 @@ import com.github.jk1.license.render.ReportRenderer
import com.github.vlsi.gradle.dsl.configureEach
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.internal.hash.ChecksumService
+import org.gradle.internal.os.OperatingSystem
import org.gradle.kotlin.dsl.support.serviceOf
import java.io.File
import java.util.Locale
@@ -164,7 +165,14 @@ subprojects {
java {
toolchain {
+ // Some JDK vendors like Homebrew installed OpenJDK 17 have problems in building trino-connector:
+ // It will cause tests of Trino-connector hanging forever on macOS, to avoid this issue and
+ // other vendor-related problems, Gravitino will use the specified AMAZON OpenJDK 17 to build
+ // Trino-connector on macOS.
if (project.name == "trino-connector") {
+ if (OperatingSystem.current().isMacOsX) {
+ vendor.set(JvmVendorSpec.AMAZON)
+ }
languageVersion.set(JavaLanguageVersion.of(17))
} else {
languageVersion.set(JavaLanguageVersion.of(extra["jdkVersion"].toString().toInt()))
diff --git a/docs/how-to-build.md b/docs/how-to-build.md
index 3c72b30cbd..91f5489d2a 100644
--- a/docs/how-to-build.md
+++ b/docs/how-to-build.md
@@ -17,7 +17,7 @@ This software is licensed under the Apache License version 2."
+ Gravitino requires at least JDK8 and at most JDK17 to run Gradle, so you need to
install JDK8 to 17 version to launch the build environment.
+ Gravitino itself supports using JDK8, 11, and 17 to build, Gravitino Trino connector uses
- JDK17 to build. You don't have to preinstall the specified JDK environment,
+ JDK17 to build (to avoid the vendor-related issues on some platform, Gravitino will use the specified Amazon Corretto OpenJDK 17 to build Trino connector on macOS). You don't have to preinstall the specified JDK environment,
+ Gradle detects the JDK version needed and downloads it automatically.
+ Gravitino uses Gradle Java Toolchain to detect and manage JDK versions, it checks the
installed JDK by running `./gradlew javaToolchains` command. For the details of Gradle Java