quarkusio/quarkus · error · AppModelResolverException

${coords} is missing version and is not found among the depe

Error message

${coords} is missing version and is not found among the dependency constraints

What it means

When resolving a workspace module's direct dependencies, any dependency without an explicit version must inherit its version from the module's dependency constraints (managed deps, including imported BOMs). If neither is present, the resolver cannot construct a Maven artifact and throws this AppModelResolverException naming the dependency in compact coordinates form.

Source

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

                .setResolvedPaths(resolvedPaths.build())
                .setWorkspaceModule(module);

        final Map<ArtifactKey, Dependency> managedDeps = new HashMap<>();
        for (io.quarkus.maven.dependency.Dependency d : module.getDirectDependencyConstraints()) {
            if (io.quarkus.maven.dependency.Dependency.SCOPE_IMPORT.equals(d.getScope())) {
                DependencyUtils.putAll(managedDeps, mvn.resolveDescriptor(toAetherArtifact(d)).getManagedDependencies());
            } else {
                managedDeps.put(d.getKey(), new Dependency(toAetherArtifact(d), d.getScope(), d.isOptional(),
                        toAetherExclusions(d.getExclusions())));
            }
        }
        final List<Dependency> directDeps = new ArrayList<>(module.getDirectDependencies().size());
        for (io.quarkus.maven.dependency.Dependency d : module.getDirectDependencies()) {
            String version = d.getVersion();
            if (version == null) {
                final Dependency constraint = managedDeps.get(d.getKey());
                if (constraint == null) {
                    throw new AppModelResolverException(
                            d.toCompactCoords() + " is missing version and is not found among the dependency constraints");
                }
                version = constraint.getArtifact().getVersion();
            }
            directDeps.add(new Dependency(
                    new DefaultArtifact(d.getGroupId(), d.getArtifactId(), d.getClassifier(), null, version,
                            mvn.getSession().getArtifactTypeRegistry().get(d.getType())),
                    d.getScope(), d.isOptional(), toAetherExclusions(d.getExclusions())));
        }

        return buildAppModel(mainDep, mainArtifact, directDeps, mvn.getRepositories(), Set.of(), managedDeps);
    }

    private ApplicationModel doResolveModel(ArtifactCoords coords,
            List<Dependency> directMvnDeps,
            Set<ArtifactKey> excludedArtifacts,
            ArtifactCoords managingProject,
            Set<ArtifactKey> reloadableModules)

View on GitHub (pinned to e1c734241f)

Solutions

  1. Add an explicit <version> to the dependency in the module's POM or WorkspaceModule definition.
  2. Declare the version via a dependency constraint (direct <dependencyManagement> entry or imported BOM) that matches the dependency's group:artifact:key.
  3. If using a BOM, verify it is listed under dependencyManagement with scope=import and that the import itself resolves.

Example fix

// before
Dependency d = Dependency.of("io.quarkus", "quarkus-arc"); // no version
// after
Dependency d = Dependency.of("io.quarkus", "quarkus-arc", "3.15.0");
// or add a constraint:
module.addDirectDependencyConstraint(Dependency.of("io.quarkus", "quarkus-bom", "3.15.0").asPomDependency().withScope("import"));
Defensive patterns

Strategy: validation

Validate before calling

for (var d : module.getDirectDependencies()) {
    boolean managed = module.getDirectDependencyConstraints().stream()
        .anyMatch(c -> c.getKey().equals(d.getKey()) || c.getScope().equals("import"));
    if (d.getVersion() == null && !managed) {
        throw new IllegalStateException("Dependency " + d.getKey() + " has no version and no matching constraint");
    }
}

Type guard

static boolean hasResolvableVersion(io.quarkus.maven.dependency.Dependency d) {
    return d.getVersion() != null || d.getType().equals("pom"); // BOM imports may omit version handling elsewhere
}

Try / catch

try {
    model = resolver.resolveModel(module);
} catch (AppModelResolverException e) {
    if (e.getMessage().contains("is missing version")) {
        throw new IllegalStateException("Add a version or a dependencyManagement entry for: " + e.getMessage(), e);
    }
    throw e;
}

Prevention

When it happens

Trigger: resolveModel(WorkspaceModule) iterates module.getDirectDependencies(); a dependency `d` has getVersion() == null and managedDeps.get(d.getKey()) == null, i.e. no matching entry among getDirectDependencyConstraints() or imported BOM-managed deps.

Common situations: Hand-built WorkspaceModule instances (custom tooling, test harnesses) that omit <version> without declaring the dependencyManagement/BOM; a dependency relying on a parent POM's dependencyManagement that is not represented in the workspace constraints.

Related errors


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