{"record":{"id":"752c7bcdcbcb3cc6","repo":"quarkusio/quarkus","slug":"failed-to-collect-dependencies-of-pom","errorCode":null,"errorMessage":"Failed to collect dependencies of <pom>","messagePattern":"Failed to collect dependencies of <pom>","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"devtools/maven/src/main/java/io/quarkus/maven/GoOfflineMojo.java","lineNumber":111,"sourceCode":"            excludedScopes = Set.of();\n        } else if (mode.equalsIgnoreCase(\"dev\") || mode.equalsIgnoreCase(\"development\")) {\n            appModelResolver.setDevMode(true);\n            excludedScopes = Set.of(\"test\");\n        } else if (mode.equalsIgnoreCase(\"prod\") || mode.isEmpty()) {\n            excludedScopes = Set.of(\"test\", \"provided\");\n        } else {\n            throw new IllegalArgumentException(\n                    \"Unrecognized mode '\" + mode + \"', supported values are test, dev, development, prod\");\n        }\n\n        final DependencyNode root;\n        try {\n            root = resolver.getSystem().collectDependencies(\n                    resolver.getSession(),\n                    resolver.newCollectManagedRequest(pom, List.of(), List.of(), List.of(), List.of(), excludedScopes))\n                    .getRoot();\n        } catch (Exception e) {\n            throw new MojoExecutionException(\"Failed to collect dependencies of \" + pom, e);\n        }\n\n        final LocalWorkspace workspace = resolver.getMavenContext().getWorkspace();\n        final List<Path> createdDirs = new ArrayList<>(workspace.getProjects().size());\n        try {\n            ensureResolvableModule(root, workspace, createdDirs);\n            appModelResolver.resolveModel(ArtifactCoords.of(pom.getGroupId(), pom.getArtifactId(), pom.getClassifier(),\n                    pom.getExtension(), pom.getVersion()));\n        } catch (AppModelResolverException e) {\n            throw new MojoExecutionException(\"Failed to resolve Quarkus application model for \" + project.getArtifact(), e);\n        } finally {\n            for (Path d : createdDirs) {\n                IoUtils.recursiveDelete(d);\n            }\n        }\n    }\n\n    private MavenArtifactResolver getResolver() throws MojoExecutionException {","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/maven/src/main/java/io/quarkus/maven/GoOfflineMojo.java#L93-L129","documentation":"GoOfflineMojo fails when the Maven resolver cannot collect the dependency graph of the project POM. This mojo pre-downloads everything needed to build offline, so dependency collection is its first critical step. Any exception during resolution (unresolvable artifacts, repository errors, corrupted local repo) is wrapped in this MojoExecutionException.","triggerScenarios":"Running `mvn quarkus:go-offline` when a dependency cannot be located, a repository is unreachable, the POM is malformed, or the local repository (~/.m2/repository) contains corrupted/partial downloads.","commonSituations":"Corporate proxy blocking Maven Central or custom repos; SNAPSHOT resolution failures; a removed version pinned in dependencyManagement; corrupted .m2 cache after an interrupted download.","solutions":["Run `mvn -U quarkus:go-offline` to force refresh snapshots and retry","Check network/proxy settings in settings.xml and verify the repository URLs are reachable","Delete the offending directory in ~/.m2/repository and re-run","Run `mvn validate` first to confirm the POM itself is well-formed","Inspect the cause chain: the wrapped Exception names the artifact that failed"],"exampleFix":"// before\nmvn quarkus:go-offline\n// after\nmvn -U -s ~/.m2/settings-with-proxy.xml quarkus:go-offline","handlingStrategy":"try-catch","validationCode":"// pre-check: ensure POM exists and local repo dir is writable\nPath pom = Path.of(\"pom.xml\");\nif (!Files.isRegularFile(pom)) throw new IllegalStateException(\"pom.xml missing\");\nPath m2 = Path.of(System.getProperty(\"user.home\"), \".m2\", \"repository\");\nif (!Files.isWritable(m2)) throw new IllegalStateException(\"~/.m2/repository not writable\");","typeGuard":null,"tryCatchPattern":"try {\n    new GoOfflineMojo-like execution()...\n} catch (MojoExecutionException e) {\n    Throwable root = e; while (root.getCause() != null) root = root.getCause();\n    log.error(\"Dependency collection failed: \" + root.getMessage());\n    // retry with -U or fix the artifact named in root.getMessage()\n}","preventionTips":["Run mvn validate before go-offline in CI pipelines","Use -U periodically to refresh SNAPSHOT metadata","Keep settings.xml proxy/repository config under version control","Monitor disk space on CI runners"],"tags":["maven","dependency-resolution","offline-build"],"backgroundTag":"dependency-resolution-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}