elastic/elasticsearch · error · GradleException
Cannot resolve minimum compiler version via VersionPropertie
Error message
Cannot resolve minimum compiler version via VersionPropertiesBuildService
What it means
This narrower IOException wrapper is thrown by resolveJavaVersion when FileUtils.readFileToString cannot read the minimumCompilerVersion or minimumRuntimeVersion resource file under infoPath. Despite the message naming only the compiler path, the same method serves both the runtime and compiler resolution via computeIfAbsent in the constructor. It indicates the Java toolchain floor for the build cannot be determined.
Source
Thrown at build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/VersionPropertiesBuildService.java:57
}
}
private JavaVersion resolveMinimumRuntimeJavaVersion(File infoPath) {
return resolveJavaVersion(infoPath, "src/main/resources/minimumRuntimeVersion");
}
private JavaVersion resolveMinimumCompilerJavaVersion(File infoPath) {
return resolveJavaVersion(infoPath, "src/main/resources/minimumCompilerVersion");
}
private JavaVersion resolveJavaVersion(File infoPath, String path) {
final JavaVersion minimumJavaVersion;
File minimumJavaInfoSource = new File(infoPath, path);
try {
String versionString = FileUtils.readFileToString(minimumJavaInfoSource);
minimumJavaVersion = JavaVersion.toVersion(versionString);
} catch (IOException e) {
throw new GradleException("Cannot resolve minimum compiler version via VersionPropertiesBuildService", e);
}
return minimumJavaVersion;
}
public Properties getProperties() {
return properties;
}
@Override
public void close() throws Exception {
}
public interface Params extends BuildServiceParameters {
RegularFileProperty getInfoPath();
}
}
View on GitHub (pinned to db6a809a66)
Solutions
- Confirm build-conventions/src/main/resources/minimumRuntimeVersion and minimumCompilerVersion exist and contain a single version token.
- Restore them via git: `git checkout HEAD -- build-conventions/src/main/resources`.
- Check read permissions on the resources directory for the build user.
- If you relocated resources, update the infoPath parameter passed to the build service to the new root.
Example fix
// before: minimumCompilerVersion missing -> IOException // restore the tracked resource git checkout HEAD -- build-conventions/src/main/resources/minimumCompilerVersion build-conventions/src/main/resources/minimumRuntimeVersion
Defensive patterns
Strategy: validation
Validate before calling
File infoPath = getParameters().getInfoPath().getAsFile().get();
for (String rel : List.of("src/main/resources/minimumRuntimeVersion", "src/main/resources/minimumCompilerVersion")) {
File f = new File(infoPath, rel);
if (!f.isFile() || FileUtils.readFileToString(f).isBlank()) {
throw new GradleException("Minimum Java version file missing or blank: " + f);
}
} Prevention
- Keep minimumRuntimeVersion/minimumCompilerVersion under git and never delete them.
- If you fork the build, update infoPath to the new resources root.
- Add a CI step that asserts these files exist and contain a single version token.
When it happens
Trigger: Calling VersionPropertiesBuildService when new File(infoPath, "src/main/resources/minimumRuntimeVersion") or ".../minimumCompilerVersion" does not exist, is a directory, or is unreadable, so FileUtils.readFileToString throws IOException. JavaVersion.toVersion on a null/blank string would surface as a different exception.
Common situations: The build-conventions resources subtree was not checked out; an IDE or build agent deleted generated resource files; a custom fork relocated the resources folder without updating infoPath; permissions deny read access to the resources directory.
Related errors
- Cannot load VersionPropertiesBuildService
- Failed to build classpath URLs.
- Elasticsearch version is missing from properties.
- Expected elasticsearch version to be numbers only of the for
- Invalid qualifier: ${qualifier}
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/2993000ceb8bdcc2.
Report an issue: GitHub.