GoogleContainerTools/jib · error · MojoExecutionException

Failed to generate a Jib file map for sync with Skaffold

Error message

Failed to generate a Jib file map for sync with Skaffold

What it means

SyncMapMojo.execute wraps its whole sync-map generation in a catch-all for Exception and rethrows it as a MojoExecutionException. This means any failure while computing the Jib file map (the mapping of build-output files to container paths used by Skaffold's sync feature) surfaces with this generic message; the real cause is in the wrapped exception. The plugin prints the sync map JSON to stdout with a BEGIN JIB JSON: SYNCMAP/1 marker for Skaffold to consume.

Source

Thrown at jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/skaffold/SyncMapMojo.java:104

      MavenRawConfiguration configuration = new MavenRawConfiguration(this);

      try {
        String syncMapJson =
            PluginConfigurationProcessor.getSkaffoldSyncMap(
                configuration,
                projectProperties,
                skaffold.sync.excludes.stream()
                    .map(File::toPath)
                    .map(Path::toAbsolutePath)
                    .collect(Collectors.toSet()));

        System.out.println();
        System.out.println("BEGIN JIB JSON: SYNCMAP/1");
        System.out.println(syncMapJson);

      } catch (Exception ex) {
        throw new MojoExecutionException(
            "Failed to generate a Jib file map for sync with Skaffold", ex);
      }
    }
  }
}

View on GitHub (pinned to fb949e2676)

Solutions

  1. Read the wrapped `cause` exception in the full Maven stack trace (run with -e / -X) — the generic message always hides the real failure there.
  2. Verify the project builds normally first (`mvn package`) — a broken build output breaks sync-map generation.
  3. Check your Skaffold and jib-maven-plugin versions are compatible; upgrade jib-maven-plugin to the latest release.
  4. If sync is not needed, remove `jib` from skaffold.yaml sync config or use `manual` sync so the sync map is not generated.

Example fix

// before (Symptom: generic MojoExecutionException with unknown cause)
mvn jib:_skaffold-sync-map
// after (Reveal the real cause)
mvn -e jib:_skaffold-sync-map
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure the project builds before invoking the sync map goal
mvn -q package -DskipTests || exit 1

Try / catch

// the real cause is always wrapped; read it
try { ... } catch (MojoExecutionException e) {
  e.getCause().printStackTrace(); // inspect the underlying failure
}

Prevention

When it happens

Trigger: Running `mvn jib:_skaffold-sync-map` (or `jib:_skaffold-files-v2`-driven sync) fails while generating the sync map JSON — e.g. the build's output files cannot be resolved, project/artifact processing fails, or any unexpected exception occurs inside execute().

Common situations: Using Skaffold with Jib and the Maven project produces unexpected output files or the Mojo cannot enumerate classpath resources; malformed Skaffold/Jib invocation; internal bugs in snapshotting the build output.

Related errors


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