quarkusio/quarkus · error · MojoExecutionException

Failed to collect runtime dependencies of ${project.getArtif

Error message

Failed to collect runtime dependencies of ${project.getArtifact()}

What it means

While finding the Quarkus core version, the mojo collects the runtime dependency graph via Maven Resolver (repoSystem.collectDependencies). Any exception other than MojoExecutionException during collection is wrapped as 'Failed to collect runtime dependencies of <artifact>'.

Source

Thrown at independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java:729

    private void setBuiltWithQuarkusCoreVersion(String coreVersion, ObjectNode extObject) throws MojoExecutionException {
        if (coreVersion != null) {
            ObjectNode metadata = getMetadataNode(extObject);
            metadata.put("built-with-quarkus-core", coreVersion);
        } else if (!ignoreNotDetectedQuarkusCoreVersion) {
            throw new MojoExecutionException("Failed to determine the Quarkus core version used to build the extension");
        }
    }

    private String findQuarkusCoreVersion() throws MojoExecutionException {
        final QuarkusCoreDeploymentVersionLocator coreVersionLocator = new QuarkusCoreDeploymentVersionLocator();
        final DependencyNode root;
        try {
            root = repoSystem.collectDependencies(repoSession, newCollectRuntimeDepsRequest()).getRoot();
        } catch (MojoExecutionException e) {
            throw e;
        } catch (Exception e) {
            throw new MojoExecutionException("Failed to collect runtime dependencies of " + project.getArtifact(), e);
        }
        root.accept(coreVersionLocator);
        return coreVersionLocator.coreVersion;
    }

    private void addExtensionDependencies(ObjectNode extObject) throws MojoExecutionException {
        final AtomicReference<ArrayNode> extensionDeps = new AtomicReference<>();
        final DependencyVisitor capabilityCollector = new DependencyVisitor() {
            @Override
            public boolean visitEnter(DependencyNode node) {
                final org.eclipse.aether.artifact.Artifact a = node.getArtifact();
                if (a != null && a.getFile() != null && a.getExtension().equals("jar")) {
                    Path p = a.getFile().toPath();
                    boolean isExtension = false;
                    if (Files.isDirectory(p)) {
                        isExtension = getExtensionDescriptorOrNull(p) != null;
                    } else {
                        // in some cases a local dependency might not producing the classes directory

View on GitHub (pinned to e1c734241f)

Solutions

  1. Run mvn -U to force update snapshots and refresh metadata
  2. Delete the offending artifact directory from ~/.m2/repository and rebuild
  3. Check network/proxy settings and repository availability in settings.xml
  4. Inspect the cause in the stack trace for the specific unresolvable artifact

Example fix

// not code-fixable; typically environment
// before: broken ~/.m2 entry
rm -rf ~/.m2/repository/<offending/group/artifact>
mvn clean install
Defensive patterns

Strategy: retry

Validate before calling

mvn -U dependency:resolve

Try / catch

try {
  mojo.execute();
} catch (MojoExecutionException e) {
  if (e.getMessage().contains("Failed to collect runtime dependencies")) {
    // clean local repo entry and retry
  }
}

Prevention

When it happens

Trigger: repoSystem.collectDependencies throws (corrupt local repo, unreachable remote, invalid pom of a dependency) when executed for this project's runtime artifact.

Common situations: Corrupted ~/.m2 repository entries; dependency POMs invalid; network failure reaching remote repositories; snapshot resolution issues.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/f8eb1052cdbbd9a4. Report an issue: GitHub.