quarkusio/quarkus · error · IllegalArgumentException

Failed to locate among application dependencies

Error message

Failed to locate  among application dependencies

What it means

getResolvedDependency(key) looks up an artifact key in the application model being built (appBuilder.getDependency(key)); if absent — and it is not the application's own artifact — it throws this IllegalArgumentException. It means the resolver was asked for a dependency (typically while wiring an extension node) that was never recorded in the resolved application dependency set.

Source

Thrown at independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/ApplicationDependencyResolver.java:1329

                    sb.append(", build-time classpath");
                }
                if (d.isFlagSet(DependencyFlags.RUNTIME_EXTENSION_ARTIFACT)) {
                    sb.append(", extension");
                }
                if (d.isFlagSet(DependencyFlags.RELOADABLE)) {
                    sb.append(", reloadable");
                }
            }
            sb.append(')');
        }

        private ResolvedDependencyBuilder getResolvedDependency(ArtifactKey key) {
            var resolvedDep = appBuilder.getDependency(key);
            if (resolvedDep == null) {
                if (appBuilder.getApplicationArtifact().getKey().equals(key)) {
                    return appBuilder.getApplicationArtifact();
                }
                throw new IllegalArgumentException("Failed to locate " + key + " among application dependencies");
            }
            return resolvedDep;
        }
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Check mvn dependency:tree for the artifact key in the message and understand why it is absent (scope, exclusion, conflict mediation).
  2. Remove <exclusions> or scope restrictions that filter the artifact out of the runtime classpath.
  3. If using workspace discovery (local project builds), verify the project is part of the build (included in the reactor/quarkus.workspace.application-... config).
  4. Reproduce with a minimal pom.xml and report to Quarkus if the dependency is clearly on the classpath — likely a resolver bug.

Example fix

// before: artifact excluded, later looked up by an extension
<dependency>
  <groupId>com.acme</groupId>
  <artifactId>myext</artifactId>
  <exclusions>
    <exclusion><groupId>io.quarkus</groupId><artifactId>quarkus-core</artifactId></exclusion>
  </exclusions>
</dependency>
// after: drop the exclusion
<dependency>
  <groupId>com.acme</groupId>
  <artifactId>myext</artifactId>
</dependency>
Defensive patterns

Strategy: validation

Validate before calling

// confirm the artifact is on the effective classpath before the build
Process p = new ProcessBuilder("mvn", "dependency:tree", "-Dverbose")
    .inheritIO().start();
p.waitFor();
// inspect output: the missing key must appear without 'omitted for conflict' or exclusion

Prevention

When it happens

Trigger: BuildDependencyGraphVisitor.getResolvedDependency(ArtifactKey) is called with a key not present in appBuilder — e.g. a dependency node reached during graph visiting that was skipped by scope/optional filters earlier, or a key referring to a workspace/artifact filtered out of the final model.

Common situations: Dependencies excluded by scope (test/provided) but referenced by extension processing; workspace modules excluded via quarkus.workspace or .mvn/maven.config settings; version conflicts removing a node whose key is later requested; bootstrap bugs with conditional extension dependencies.

Related errors


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