{"record":{"id":"b8168339d3c0cdb0","repo":"GoogleContainerTools/jib","slug":"failed-to-resolve-dependencies","errorCode":null,"errorMessage":"Failed to resolve dependencies","messagePattern":"Failed to resolve dependencies","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/skaffold/FilesMojoV2.java","lineNumber":207,"sourceCode":"            }\n            // we only want compile/runtime deps\n            return Artifact.SCOPE_COMPILE_PLUS_RUNTIME.contains(node.getDependency().getScope());\n          };\n\n      try {\n        DependencyResolutionResult resolutionResult =\n            projectDependenciesResolver.resolve(\n                new DefaultDependencyResolutionRequest(project, session.getRepositorySession())\n                    .setResolutionFilter(ignoreProjectDependenciesFilter));\n        resolutionResult.getDependencies().stream()\n            .map(org.eclipse.aether.graph.Dependency::getArtifact)\n            .filter(org.eclipse.aether.artifact.Artifact::isSnapshot)\n            .map(org.eclipse.aether.artifact.Artifact::getFile)\n            .map(File::toPath)\n            .forEach(skaffoldFilesOutput::addInput);\n\n      } catch (DependencyResolutionException ex) {\n        throw new MojoExecutionException(\"Failed to resolve dependencies\", ex);\n      }\n    }\n\n    try {\n      // Print JSON string\n      System.out.println();\n      System.out.println(\"BEGIN JIB JSON\");\n      System.out.println(skaffoldFilesOutput.getJsonString());\n    } catch (IOException ex) {\n      throw new MojoExecutionException(ex.getMessage(), ex);\n    }\n  }\n\n  private List<Path> resolveExtraDirectories(MavenProject project) {\n    return collectExtraDirectories(project).stream()\n        .map(path -> path.isAbsolute() ? path : project.getBasedir().toPath().resolve(path))\n        .collect(Collectors.toList());\n  }","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/skaffold/FilesMojoV2.java#L189-L225","documentation":"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.","triggerScenarios":"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.","commonSituations":"Snapshot dependencies purged from the remote repo; wrong groupId/artifactId/version in pom.xml; offline CI environments; unreachable private repositories; broken ~/.m2 settings.","solutions":["Run 'mvn dependency:resolve -U' and fix the reported dependency that cannot be resolved (typo, missing version, missing repo).","Check network/repository access and ~/.m2/settings.xml credentials for private repos.","Force snapshot refresh with -U or pin snapshot dependencies to fixed versions.","Verify all dependency versions exist (use mvn versions:display-dependency-updates or search the repo)."],"exampleFix":"// before\n<dependency><groupId>com.example</groupId><artifactId>lib</artifactId><version>1.2-SNAPSHOT</version></dependency>\n// after (pin to a resolvable release)\n<dependency><groupId>com.example</groupId><artifactId>lib</artifactId><version>1.2.0</version></dependency>","handlingStrategy":"validation","validationCode":"// Before running skaffold-files, verify all dependencies resolve:\n// mvn -U dependency:resolve  (fix any reported unresolvable artifact first)","typeGuard":null,"tryCatchPattern":"try { ... } catch (MojoExecutionException e) { if (e.getMessage().equals(\"Failed to resolve dependencies\")) { /* inspect e.getCause() DependencyResolutionException for the failing artifact */ } }","preventionTips":["Run mvn dependency:resolve -U in CI before Skaffold steps","Pin dependency versions; avoid relying on purged -SNAPSHOT artifacts","Keep ~/.m2/settings.xml repository credentials current","Ensure CI has network access to all configured repositories"],"tags":["maven","dependencies","resolution","skaffold"],"backgroundTag":"missing-dependency","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"}