GoogleContainerTools/jib · error · MojoExecutionException

<extraDirectories><paths> contain "from" directory that does

Error message

<extraDirectories><paths> contain "from" directory that doesn't exist locally: <path>

What it means

Thrown as a MojoExecutionException from BuildTarMojo.execute when a directory configured under <extraDirectories><paths> with a 'from' attribute does not exist on the local filesystem (ExtraDirectoryNotFoundException). Jib includes the missing path in the message.

Source

Thrown at jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/BuildTarMojo.java:162

          HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForMaven(
              ex.getBaseImageMajorJavaVersion(), ex.getProjectMajorJavaVersion()),
          ex);

    } catch (InvalidImageReferenceException ex) {
      throw new MojoExecutionException(
          HelpfulSuggestions.forInvalidImageReference(ex.getInvalidReference()), ex);

    } catch (IOException
        | CacheDirectoryCreationException
        | MainClassInferenceException
        | InvalidGlobalConfigException ex) {
      throw new MojoExecutionException(ex.getMessage(), ex);

    } catch (BuildStepsExecutionException ex) {
      throw new MojoExecutionException(ex.getMessage(), ex.getCause());

    } catch (ExtraDirectoryNotFoundException ex) {
      throw new MojoExecutionException(
          "<extraDirectories><paths> contain \"from\" directory that doesn't exist locally: "
              + ex.getPath(),
          ex);
    } finally {
      tempDirectoryProvider.close();
      MojoCommon.finishUpdateChecker(projectProperties, updateCheckFuture);
      projectProperties.waitForLoggingThread();
      getLog().info("");
    }
  }
}

View on GitHub (pinned to fb949e2676)

Solutions

  1. Create the directory referenced by the 'from' value, or fix the path in <extraDirectories><paths> to point at the existing directory.
  2. If the directory is generated, ensure the generating Maven execution (e.g. a plugin's generate-resources phase) runs before jib.
  3. Check for typos and correct relative-vs-absolute path resolution (relative paths resolve against the module directory).
  4. If no extra directories are needed, remove the <extraDirectories> configuration entirely.

Example fix

// before
<extraDirectories><paths><path><from>src/main/jibx</from></path></paths></extraDirectories>
// after
<extraDirectories><paths><path><from>src/main/jib</from></path></paths></extraDirectories>
Defensive patterns

Strategy: validation

Validate before calling

// In a Maven Enforcer/rule or script, before the jib goal:
String from = "src/main/jib"; // value configured under <extraDirectories><paths>
java.io.File dir = new java.io.File(project.getBasedir(), from);
if (!dir.isDirectory()) throw new IllegalStateException("extra directory missing: " + dir);

Prevention

When it happens

Trigger: Configuring <extraDirectories><paths><path><from>src/main/jib-extra</from></path></paths> where that directory is absent at build time; also when the path is generated by another Maven phase that didn't run, or when a relative path resolves against an unexpected working directory.

Common situations: Renaming or deleting an extras directory without updating the POM; CI checkouts that exclude the directory; build-order issues where a resource-generation step hasn't produced the directory yet.

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


AI-assisted analysis of GoogleContainerTools/jib@fb949e2676 (2026-09-06). Data as JSON: /api/errors/8448f73eeeabef70. Report an issue: GitHub.