quarkusio/quarkus · error · MojoExecutionException
Failed to collect dependencies of <pom>
Error message
Failed to collect dependencies of <pom>
What it means
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.
Source
Thrown at devtools/maven/src/main/java/io/quarkus/maven/GoOfflineMojo.java:111
excludedScopes = Set.of();
} else if (mode.equalsIgnoreCase("dev") || mode.equalsIgnoreCase("development")) {
appModelResolver.setDevMode(true);
excludedScopes = Set.of("test");
} else if (mode.equalsIgnoreCase("prod") || mode.isEmpty()) {
excludedScopes = Set.of("test", "provided");
} else {
throw new IllegalArgumentException(
"Unrecognized mode '" + mode + "', supported values are test, dev, development, prod");
}
final DependencyNode root;
try {
root = resolver.getSystem().collectDependencies(
resolver.getSession(),
resolver.newCollectManagedRequest(pom, List.of(), List.of(), List.of(), List.of(), excludedScopes))
.getRoot();
} catch (Exception e) {
throw new MojoExecutionException("Failed to collect dependencies of " + pom, e);
}
final LocalWorkspace workspace = resolver.getMavenContext().getWorkspace();
final List<Path> createdDirs = new ArrayList<>(workspace.getProjects().size());
try {
ensureResolvableModule(root, workspace, createdDirs);
appModelResolver.resolveModel(ArtifactCoords.of(pom.getGroupId(), pom.getArtifactId(), pom.getClassifier(),
pom.getExtension(), pom.getVersion()));
} catch (AppModelResolverException e) {
throw new MojoExecutionException("Failed to resolve Quarkus application model for " + project.getArtifact(), e);
} finally {
for (Path d : createdDirs) {
IoUtils.recursiveDelete(d);
}
}
}
private MavenArtifactResolver getResolver() throws MojoExecutionException {View on GitHub (pinned to e1c734241f)
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
Example fix
// before mvn quarkus:go-offline // after mvn -U -s ~/.m2/settings-with-proxy.xml quarkus:go-offline
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-check: ensure POM exists and local repo dir is writable
Path pom = Path.of("pom.xml");
if (!Files.isRegularFile(pom)) throw new IllegalStateException("pom.xml missing");
Path m2 = Path.of(System.getProperty("user.home"), ".m2", "repository");
if (!Files.isWritable(m2)) throw new IllegalStateException("~/.m2/repository not writable"); Try / catch
try {
new GoOfflineMojo-like execution()...
} catch (MojoExecutionException e) {
Throwable root = e; while (root.getCause() != null) root = root.getCause();
log.error("Dependency collection failed: " + root.getMessage());
// retry with -U or fix the artifact named in root.getMessage()
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Corporate proxy blocking Maven Central or custom repos; SNAPSHOT resolution failures; a removed version pinned in dependencyManagement; corrupted .m2 cache after an interrupted download.
Related errors
- Could not resolve POM for
- Failed to resolve application model <appArtifact> dependenci
- Failed to resolve application model <appArtifact> dependenci
- Failed to resolve application model <appArtifact> dependenci
- Resolution of annotationProcessorPath dependencies failed: <
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/752c7bcdcbcb3cc6.
Report an issue: GitHub.