GoogleContainerTools/jib · error · MojoExecutionException

Failed to resolve dependencies

Error message

Failed to resolve dependencies

What it means

FilesMojoV2 (the skaffold-files goal) resolves the project's dependency artifacts so it can list the files Skaffold should watch. If Maven's dependency resolution fails (unresolvable coordinates, missing artifacts, repository errors), the DependencyResolutionException is wrapped in this MojoExecutionException. The original resolver exception is attached as the cause.

Source

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

            }
            // we only want compile/runtime deps
            return Artifact.SCOPE_COMPILE_PLUS_RUNTIME.contains(node.getDependency().getScope());
          };

      try {
        DependencyResolutionResult resolutionResult =
            projectDependenciesResolver.resolve(
                new DefaultDependencyResolutionRequest(project, session.getRepositorySession())
                    .setResolutionFilter(ignoreProjectDependenciesFilter));
        resolutionResult.getDependencies().stream()
            .map(org.eclipse.aether.graph.Dependency::getArtifact)
            .filter(org.eclipse.aether.artifact.Artifact::isSnapshot)
            .map(org.eclipse.aether.artifact.Artifact::getFile)
            .map(File::toPath)
            .forEach(skaffoldFilesOutput::addInput);

      } catch (DependencyResolutionException ex) {
        throw new MojoExecutionException("Failed to resolve dependencies", ex);
      }
    }

    try {
      // Print JSON string
      System.out.println();
      System.out.println("BEGIN JIB JSON");
      System.out.println(skaffoldFilesOutput.getJsonString());
    } catch (IOException ex) {
      throw new MojoExecutionException(ex.getMessage(), ex);
    }
  }

  private List<Path> resolveExtraDirectories(MavenProject project) {
    return collectExtraDirectories(project).stream()
        .map(path -> path.isAbsolute() ? path : project.getBasedir().toPath().resolve(path))
        .collect(Collectors.toList());
  }

View on GitHub (pinned to fb949e2676)

Solutions

  1. Run 'mvn dependency:resolve -U' and fix the reported dependency that cannot be resolved (typo, missing version, missing repo).
  2. Check network/repository access and ~/.m2/settings.xml credentials for private repos.
  3. Force snapshot refresh with -U or pin snapshot dependencies to fixed versions.
  4. Verify all dependency versions exist (use mvn versions:display-dependency-updates or search the repo).

Example fix

// before
<dependency><groupId>com.example</groupId><artifactId>lib</artifactId><version>1.2-SNAPSHOT</version></dependency>
// after (pin to a resolvable release)
<dependency><groupId>com.example</groupId><artifactId>lib</artifactId><version>1.2.0</version></dependency>
Defensive patterns

Strategy: validation

Validate before calling

// Before running skaffold-files, verify all dependencies resolve:
// mvn -U dependency:resolve  (fix any reported unresolvable artifact first)

Try / catch

try { ... } catch (MojoExecutionException e) { if (e.getMessage().equals("Failed to resolve dependencies")) { /* inspect e.getCause() DependencyResolutionException for the failing artifact */ } }

Prevention

When it happens

Trigger: Executing the skaffold-files goal when MavenProject.getArtifacts()/dependency resolution via the repository system throws DependencyResolutionException, e.g. a dependency artifact cannot be downloaded or resolved from configured repos.

Common situations: Snapshot dependencies purged from the remote repo; wrong groupId/artifactId/version in pom.xml; offline CI environments; unreachable private repositories; broken ~/.m2 settings.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


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