{"record":{"id":"b28951d5792ae06c","repo":"GoogleContainerTools/jib","slug":"obtaining-project-build-output-files-failed-make","errorCode":null,"errorMessage":"Obtaining project build output files failed; make sure you have ${packaged|compiled} your project before trying to build the image. (Did you accidentally run \"mvn clean jib:build\" instead of \"mvn clean ${package|compile} jib:build\"?)","messagePattern":"Obtaining project build output files failed; make sure you have (.+?) your project before trying to build the image\\. \\(Did you accidentally run \"mvn clean jib:build\" instead of \"mvn clean (.+?) jib:build\"\\?\\)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/MavenProjectProperties.java","lineNumber":318,"sourceCode":"\n        default:\n          throw new IllegalStateException(\"unknown containerizing mode: \" + containerizingMode);\n      }\n\n      // Classify and add dependencies\n      Map<LayerType, List<Path>> classifiedDependencies =\n          classifyDependencies(project.getArtifacts(), getProjectDependencies());\n\n      javaContainerBuilder.addDependencies(\n          Preconditions.checkNotNull(classifiedDependencies.get(LayerType.DEPENDENCIES)));\n      javaContainerBuilder.addSnapshotDependencies(\n          Preconditions.checkNotNull(classifiedDependencies.get(LayerType.SNAPSHOT_DEPENDENCIES)));\n      javaContainerBuilder.addProjectDependencies(\n          Preconditions.checkNotNull(classifiedDependencies.get(LayerType.PROJECT_DEPENDENCIES)));\n      return javaContainerBuilder.toContainerBuilder();\n\n    } catch (IOException ex) {\n      throw new IOException(\n          \"Obtaining project build output files failed; make sure you have \"\n              + (isPackageErrorMessage(containerizingMode) ? \"packaged\" : \"compiled\")\n              + \" your project \"\n              + \"before trying to build the image. (Did you accidentally run \\\"mvn clean \"\n              + \"jib:build\\\" instead of \\\"mvn clean \"\n              + (isPackageErrorMessage(containerizingMode) ? \"package\" : \"compile\")\n              + \" jib:build\\\"?)\",\n          ex);\n    }\n  }\n\n  @VisibleForTesting\n  Set<Artifact> getProjectDependencies() {\n    return session.getProjects().stream()\n        .map(MavenProject::getArtifact)\n        .filter(artifact -> !artifact.equals(project.getArtifact()))\n        .filter(artifact -> artifact.getFile() != null)\n        .collect(Collectors.toSet());","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/MavenProjectProperties.java#L300-L336","documentation":"Jib could not find any project build output files (jars/classes) to layer into the image because the project was compiled with 'clean' but never packaged or compiled. Maven goals like 'jib:build' do not themselves trigger the lifecycle phases that produce artifacts, so Jib has nothing to containerize and throws this IOException from MavenProjectProperties.createJibContainerBuilder.","triggerScenarios":"Running 'mvn clean jib:build' or 'mvn clean jib:dockerBuild' without a preceding 'package' (or 'compile' when containerizingMode=packaged... actually processed) phase; running jib goals directly on a freshly cleaned workspace; building from an IDE goal that skips lifecycle phases.","commonSituations":"Developer assumes the jib plugin goal runs the package phase automatically; CI scripts calling 'mvn clean jib:build'; switching containerizingMode between 'packaged' and 'exploded' so the required phase changes; typo in a wrapper script omitting 'package'.","solutions":["Run the full lifecycle before Jib: 'mvn clean package jib:build' (or 'mvn clean compile jib:build' if using containerizingMode=exploded).","Verify your containerizingMode setting (<containerizingMode> in pom.xml) matches the phase you ran — packaged requires package, exploded requires compile.","Check CI pipelines and wrapper scripts for the accidental 'mvn clean jib:build' pattern and add the missing phase.","Bind jib to the package phase via an <execution> so the artifact always exists when it runs."],"exampleFix":"// before\nmvn clean jib:build\n\n// after\nmvn clean package jib:build","handlingStrategy":"validation","validationCode":"// Check target output exists before invoking jib goals\nif (!java.nio.file.Files.exists(java.nio.file.Path.of(\"target\", \"classes\"))\n    && !java.nio.file.Files.exists(java.nio.file.Path.of(\"target\", \"*.jar\"))) {\n  throw new IllegalStateException(\"Run 'mvn package' (or 'compile' for exploded mode) before jib:build\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  // mvn clean package jib:build\n} catch (IOException e) {\n  if (e.getMessage().contains(\"Obtaining project build output files failed\")) {\n    // rerun with package phase: mvn clean package jib:build\n  }\n  throw e;\n}","preventionTips":["Always pair jib goals with a producing phase: 'mvn clean package jib:build'.","Bind the jib goal to the package phase in pom.xml executions so it never runs standalone.","Match containerizingMode (packaged vs exploded) to the phase you run.","Keep CI scripts reviewed so 'jib:build' never directly follows 'clean'."],"tags":["maven","jib","build-lifecycle","missing-artifact"],"backgroundTag":"missing-required-config","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"}