quarkusio/quarkus · error · MojoExecutionException

Failed to resolve application model <appArtifact> dependenci

Error message

Failed to resolve application model <appArtifact> dependencies

What it means

After configuring a model resolver, DependencyTreeMojo calls modelResolver.resolveModel(appArtifact) to compute the application's dependency model. Any exception during resolution (missing artifacts, bad POM, repository access problems) is wrapped in MojoExecutionException with this message and the failing artifact coordinates.

Source

Thrown at devtools/maven/src/main/java/io/quarkus/maven/DependencyTreeMojo.java:164

                    modelResolver.setTest(true);
                } else if (mode.equalsIgnoreCase("dev") || mode.equalsIgnoreCase("development")) {
                    modelResolver.setDevMode(true);
                } else if (mode.equalsIgnoreCase("prod") || mode.isEmpty()) {
                    // ignore, that's the default
                } else {
                    throw new MojoExecutionException(
                            "Parameter 'mode' was set to '" + mode + "' while expected one of 'dev', 'test' or 'prod'");
                }
            }
            modelResolver.setLegacyModelResolver(BootstrapAppModelResolver.isLegacyModelResolver(project.getProperties()));
            modelResolver.setDepLogConfig(DependencyLoggingConfig.builder()
                    .setMessageConsumer(log)
                    .setVerbose(verbose)
                    .setGraph(graph)
                    .build());
            modelResolver.resolveModel(appArtifact);
        } catch (Exception e) {
            throw new MojoExecutionException("Failed to resolve application model " + appArtifact + " dependencies", e);
        }
    }

    protected MavenArtifactResolver resolver() {
        return resolver == null
                ? resolver = workspaceProvider.createArtifactResolver(BootstrapMavenContext.config()
                        .setUserSettings(session.getRequest().getUserSettingsFile())
                        // The system needs to be initialized with the bootstrap model builder to properly interpolate system properties set on the command line
                        // e.g. -Dquarkus.platform.version=xxx
                        //.setRepositorySystem(repoSystem)
                        // The session should be initialized with the loaded workspace
                        //.setRepositorySystemSession(repoSession)
                        .setRemoteRepositories(repos)
                        // To support multi-module projects that haven't been installed
                        .setPreferPomsFromWorkspace(true))
                : resolver;
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Run `mvn install -DskipTests` on the reactor first so local modules are available in the local repository.
  2. Check network/proxy settings and verify repository credentials in ~/.m2/settings.xml (run with -e to see the root cause).
  3. Refresh/repair the local repository cache: delete the failing artifact directory under ~/.m2/repository and rebuild, or run with -U.
  4. Fix malformed dependency or repository declarations in the project pom.xml.

Example fix

// before (offline, module never installed)
mvn quarkus:dependency-tree -o
// after
mvn install -DskipTests && mvn quarkus:dependency-tree
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-flight: make sure the reactor is installed and network is available
mvn install -DskipTests
mvn dependency:resolve -U

Try / catch

// handle the wrapped MojoExecutionException and inspect the cause
try {
    // run quarkus:dependency-tree
} catch (MojoExecutionException e) {
    Throwable root = e;
    while (root.getCause() != null) root = root.getCause();
    log.error("Model resolution failed: " + root.getMessage());
}

Prevention

When it happens

Trigger: Resolving the application model for a project whose dependencies cannot be downloaded (offline mode, unreachable repository), a corrupt/invalid pom.xml, a missing local workspace module, or a snapshot artifact that no longer exists in the remote repo.

Common situations: Corporate proxy or VPN blocking Maven Central; internal repository credentials missing from settings.xml; SNAPSHOT dependency purged from remote; reactor module not built/installed before running the goal; malformed dependency declaration in pom.xml.

Related errors


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