apache/iceberg · error · GradleException
Releases must be built with Java 17
Error message
Releases must be built with Java 17
What it means
deploy.gradle enforces that release builds (invoked with the 'release' project property) run on JDK 17. Iceberg's signing/publish toolchain requires Java 17; building a release with any other JDK would produce artifacts outside the supported/reproducible toolchain, so the script fails fast with this GradleException.
Source
Thrown at deploy.gradle:21
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
if (project.hasProperty('release') && jdkVersion != '17') {
throw new GradleException("Releases must be built with Java 17")
}
subprojects {
def isBom = it.name == 'iceberg-bom'
def isOpenApi = it.name == 'iceberg-open-api'
apply plugin: 'maven-publish'
apply plugin: 'signing'
afterEvaluate {
if (!isBom) {
task sourceJar(type: Jar, dependsOn: classes) {
archiveClassifier.set('sources')
from sourceSets.main.allSource
group 'build'
}
task javadocJar(type: Jar, dependsOn: javadoc) {View on GitHub (pinned to 86d9c8fc54)
Solutions
- Build with JDK 17: point JAVA_HOME (or org.gradle.java.home in gradle.properties) at a JDK 17 installation.
- If you are not doing an official release, drop the -Prelease flag from the Gradle command.
- On CI, use a JDK 17 setup action (e.g. actions/setup-java with distribution and java-version: 17).
Example fix
// before ./gradlew -Prelease assemble # JAVA_HOME=jdk-21 // after export JAVA_HOME=/usr/lib/jvm/jdk-17 ./gradlew -Prelease assemble
Defensive patterns
Strategy: validation
Validate before calling
test "$(java -version 2>&1 | head -1)" = *"version \"17"* || echo 'Release builds need JDK 17'
Prevention
- Pin JAVA_HOME to JDK 17 in release scripts and CI release workflows.
- Only pass -Prelease on release builds.
- Check ./gradlew -q javaToolchains or java -version before tagging a release.
When it happens
Trigger: Running a Gradle invocation that includes the 'release' property (e.g. ./gradlew -Prelease assemble or the release workflow) while the configured toolchain JDK (jdkVersion) is anything other than 17.
Common situations: Local machine defaults to JDK 11 or JDK 21 via JAVA_HOME; CI runner image upgraded to a newer JDK; developer runs the release task without setting org.gradle.java.home or the toolchain property.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- The JMH benchmarks must be run with JDK 17 or JDK 21
- This build must be run with JDK 17 or 21 but was executed wi
- Neither version.txt nor git version exists:
- Neither version.txt nor git version exists
- Expected a Spark/Scala version combination in Gradle project
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/5fd744ebc30e0764.
Report an issue: GitHub.