{"record":{"id":"296454a525c6ee65","repo":"GoogleContainerTools/jib","slug":"obtaining-project-build-output-files-failed","errorCode":null,"errorMessage":"Obtaining project build output files failed","messagePattern":"Obtaining project build output files failed","errorType":"exception","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/GradleProjectProperties.java","lineNumber":285,"sourceCode":"          }\n          break;\n\n        case PACKAGED:\n          // Add a JAR\n          Jar jarTask = (Jar) project.getTasks().findByName(\"jar\");\n          Path jarPath = jarTask.getArchiveFile().get().getAsFile().toPath();\n          log(LogEvent.debug(\"Using JAR: \" + jarPath));\n          javaContainerBuilder.addToClasspath(jarPath);\n          break;\n\n        default:\n          throw new IllegalStateException(\"unknown containerizing mode: \" + containerizingMode);\n      }\n\n      return javaContainerBuilder.toContainerBuilder();\n\n    } catch (IOException ex) {\n      throw new GradleException(\"Obtaining project build output files failed\", ex);\n    }\n  }\n\n  @Override\n  public List<Path> getClassFiles() throws IOException {\n    // TODO: Consolidate with createJibContainerBuilder\n    FileCollection classesOutputDirectories =\n        getMainSourceSet().getOutput().getClassesDirs().filter(File::exists);\n    List<Path> classFiles = new ArrayList<>();\n    for (File classesOutputDirectory : classesOutputDirectories) {\n      classFiles.addAll(new DirectoryWalker(classesOutputDirectory.toPath()).walk());\n    }\n    return classFiles;\n  }\n\n  @Override\n  public List<Path> getDependencies() {\n    List<Path> dependencies = new ArrayList<>();","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/GradleProjectProperties.java#L267-L303","documentation":"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.","triggerScenarios":"An IOException while resolving jarTask.getArchiveFile() (task not produced output), reading the classes/dependencies directories, or scanning project artifacts during createJibContainerBuilder.","commonSituations":"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.","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"],"exampleFix":"// before: invoking jib directly after clean with no jar dependency\n// after\ntasks.named('jibBuildTar') { dependsOn tasks.named('jar') }","handlingStrategy":"try-catch","validationCode":"tasks.named('jibBuildTar') { dependsOn tasks.named('jar') } // or bootJar\nassert tasks.named('jar').get().archiveFile.get().asFile.exists()","typeGuard":null,"tryCatchPattern":"try {\n  /* jib task */\n} catch (GradleException e) {\n  if (e.message == 'Obtaining project build output files failed') {\n    logger.error('Run the jar/bootJar task first; check build/libs output exists')\n  } else throw e\n}","preventionTips":["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"],"tags":["jib","gradle","io","build-output"],"backgroundTag":"file-not-found","analyzedSha":"fb949e2676afbbd7dd7a1ef61e20251931325654","analyzedAt":"2026-09-06T14:04:09.491Z","contentChangedAt":"2026-09-06T14:04:09.491Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}