GoogleContainerTools/jib · error · GradleException
Obtaining project build output files failed
Error message
Obtaining project build output files failed
What it means
createJibContainerBuilder wraps any IOException from collecting the project's build output files (JAR/WAR resolution, dependency scanning) in a GradleException with the fixed message 'Obtaining project build output files failed'. It signals that Jib could not read the files it needs to package into the container, not a config parse problem.
Source
Thrown at jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/GradleProjectProperties.java:285
}
break;
case PACKAGED:
// Add a JAR
Jar jarTask = (Jar) project.getTasks().findByName("jar");
Path jarPath = jarTask.getArchiveFile().get().getAsFile().toPath();
log(LogEvent.debug("Using JAR: " + jarPath));
javaContainerBuilder.addToClasspath(jarPath);
break;
default:
throw new IllegalStateException("unknown containerizing mode: " + containerizingMode);
}
return javaContainerBuilder.toContainerBuilder();
} catch (IOException ex) {
throw new GradleException("Obtaining project build output files failed", ex);
}
}
@Override
public List<Path> getClassFiles() throws IOException {
// TODO: Consolidate with createJibContainerBuilder
FileCollection classesOutputDirectories =
getMainSourceSet().getOutput().getClassesDirs().filter(File::exists);
List<Path> classFiles = new ArrayList<>();
for (File classesOutputDirectory : classesOutputDirectories) {
classFiles.addAll(new DirectoryWalker(classesOutputDirectory.toPath()).walk());
}
return classFiles;
}
@Override
public List<Path> getDependencies() {
List<Path> dependencies = new ArrayList<>();View on GitHub (pinned to fb949e2676)
Solutions
- Run the jar (or bootJar) task before Jib, or make Jib tasks depend on it (tasks.named('jib') { dependsOn tasks.named('jar') })
- Verify the jar task output exists under build/libs and the archiveFileName configuration is valid
- Check filesystem permissions and re-run with --refresh-dependencies if dependency resolution is failing
Example fix
// before: invoking jib directly after clean with no jar dependency
// after
tasks.named('jibBuildTar') { dependsOn tasks.named('jar') } Defensive patterns
Strategy: try-catch
Validate before calling
tasks.named('jibBuildTar') { dependsOn tasks.named('jar') } // or bootJar
assert tasks.named('jar').get().archiveFile.get().asFile.exists() Try / catch
try {
/* jib task */
} catch (GradleException e) {
if (e.message == 'Obtaining project build output files failed') {
logger.error('Run the jar/bootJar task first; check build/libs output exists')
} else throw e
} Prevention
- Always build the jar/bootJar before Jib packaging tasks
- Do not rename or relocate the jar task's output directory without updating Jib configuration
- Check file permissions on the build directory in CI containers
When it happens
Trigger: An IOException while resolving jarTask.getArchiveFile() (task not produced output), reading the classes/dependencies directories, or scanning project artifacts during createJibContainerBuilder.
Common situations: Running jib tasks without first running the jar/bootJar build (missing output); jar task relocated/renamed so archiveFile points to nothing readable; filesystem permissions or missing build directory after clean in CI.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- container.appRoot is not an absolute Unix-style path: ${inva
- invalid value for containerizingMode: ${invalidContainerizin
- container.workingDirectory is not an absolute Unix-style pat
- from.platforms contains a platform configuration that is mis
- container.volumes is not an absolute Unix-style path: ${inva
AI-assisted analysis of GoogleContainerTools/jib@fb949e2676 (2026-09-06).
Data as JSON: /api/errors/296454a525c6ee65.
Report an issue: GitHub.