Fix confusing build failure when javac is missing - #151
Merged
Conversation
The server module needs javac, but Gradle starts happily on a JRE and only fails later at :pxf-api:compileJava with "Toolchain installation ... does not provide the required capabilities: [JAVA_COMPILER]", which never mentions a JDK. Check for javac before invoking Gradle so the build stops with an actionable message instead. Installing the JDK afterwards is not enough on its own: the Gradle daemon caches JVM metadata for its whole lifetime, so a daemon started while only the JRE was present replays the same error. Both the new check and the README now say to run ./gradlew --stop. Also correct the JDK prerequisites: record that 8, 11, 17 and 21 are supported, as the java-compatibility-test CI matrix already exercises, note that 1.8 support will be removed in PXF 3.0, and fix the example JAVA_HOME, which used a RHEL-style path that does not exist on Debian/Ubuntu. Fixes apache#150
ostinru
reviewed
Sep 9, 2026
ostinru
approved these changes
Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #150.
Building PXF on a machine that has a JRE but no JDK fails at
:pxf-api:compileJavawith a message that never mentions a JDK:Two things then make it hard to get out of:
/usr/lib/jvm/java-11-openjdk-amd64,the same directory a JDK would use, so
java -versionandls /usr/lib/jvmboth look healthy while
javacis absent. Gradle's error names that verydirectory, reinforcing the impression that Java is fine there.
server/gradle.propertiesenables the Gradle daemon, and the daemon caches JVM installation metadata for
its whole lifetime without re-checking the filesystem. Since the JDK lands in
the same path, Gradle reuses the existing daemon and replays the stale
verdict -- the identical error, in 2 seconds.
./gradlew --stopis required.Changes
server/Makefile-- newcheck-jdktarget, hung offprepare-gradle-wrapper(the chokepoint every Gradle target already depends on). It verifies
$JAVA_HOME/bin/javac, orjavaconPATHwhenJAVA_HOMEis unset, and failswith:
README.md-- state that a JRE is not enough and give the apt/dnf packagenames; note that on Debian/Ubuntu the
mavenpackage depends ondefault-jre-headlessand does not pull in a JDK; document the./gradlew --stoprequirement; update the supported versions from "JDK 1.8 or JDK 11" to 8, 11, 17
and 21, which is what the
java-compatibility-testmatrix inpxf-ci.ymlalreadyruns, and note that 1.8 support will be removed in PXF 3.0; sync the IntelliJ
section, which also said 1.8. Finally, fix the example
JAVA_HOME(
/usr/lib/jvm/java-11-openjdk) -- a RHEL-style path that does not exist onDebian/Ubuntu, where it needs the
-amd64suffix.No production code and no Gradle build logic is touched. CI is unaffected:
ci/docker/pxf-cbdb-dev/common/script/build_pxf.shalready installs a JDKexplicitly, which is why this only ever hit people following the README.
Testing
check-jdkwas exercised in three states:JAVA_HOMEpointing at a JRE-shapeddirectory (exit 2 with the message above),
JAVA_HOMEunset with nojavaconPATH(exit 2), andJAVA_HOMEpointing at a real JDK (exit 0).make -n compileconfirms the check runs before Gradle.
The underlying failure was reproduced end to end in a clean
ubuntu:22.04container against the
2.2.0-incubating-rc1tree:openjdk-11-jre-headlessonly[JAVA_COMPILER]error aboveopenjdk-11-jdkinstalled, daemon not stoppedBUILD FAILED in 2s./gradlew --stopBUILD SUCCESSFUL in 23sA clean Ubuntu 22.04 that installs
openjdk-11-jdkbefore the first build succeedsoutright.