{"record":{"id":"bf13b6485fe14dfe","repo":"quarkusio/quarkus","slug":"coords-is-missing-version-and-is-not-found-amon","errorCode":null,"errorMessage":"${coords} is missing version and is not found among the dependency constraints","messagePattern":"(.+?) is missing version and is not found among the dependency constraints","errorType":"exception","errorClass":"AppModelResolverException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java","lineNumber":296,"sourceCode":"                .setResolvedPaths(resolvedPaths.build())\n                .setWorkspaceModule(module);\n\n        final Map<ArtifactKey, Dependency> managedDeps = new HashMap<>();\n        for (io.quarkus.maven.dependency.Dependency d : module.getDirectDependencyConstraints()) {\n            if (io.quarkus.maven.dependency.Dependency.SCOPE_IMPORT.equals(d.getScope())) {\n                DependencyUtils.putAll(managedDeps, mvn.resolveDescriptor(toAetherArtifact(d)).getManagedDependencies());\n            } else {\n                managedDeps.put(d.getKey(), new Dependency(toAetherArtifact(d), d.getScope(), d.isOptional(),\n                        toAetherExclusions(d.getExclusions())));\n            }\n        }\n        final List<Dependency> directDeps = new ArrayList<>(module.getDirectDependencies().size());\n        for (io.quarkus.maven.dependency.Dependency d : module.getDirectDependencies()) {\n            String version = d.getVersion();\n            if (version == null) {\n                final Dependency constraint = managedDeps.get(d.getKey());\n                if (constraint == null) {\n                    throw new AppModelResolverException(\n                            d.toCompactCoords() + \" is missing version and is not found among the dependency constraints\");\n                }\n                version = constraint.getArtifact().getVersion();\n            }\n            directDeps.add(new Dependency(\n                    new DefaultArtifact(d.getGroupId(), d.getArtifactId(), d.getClassifier(), null, version,\n                            mvn.getSession().getArtifactTypeRegistry().get(d.getType())),\n                    d.getScope(), d.isOptional(), toAetherExclusions(d.getExclusions())));\n        }\n\n        return buildAppModel(mainDep, mainArtifact, directDeps, mvn.getRepositories(), Set.of(), managedDeps);\n    }\n\n    private ApplicationModel doResolveModel(ArtifactCoords coords,\n            List<Dependency> directMvnDeps,\n            Set<ArtifactKey> excludedArtifacts,\n            ArtifactCoords managingProject,\n            Set<ArtifactKey> reloadableModules)","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java#L278-L314","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add an explicit <version> to the dependency in the module's POM or WorkspaceModule definition.","Declare the version via a dependency constraint (direct <dependencyManagement> entry or imported BOM) that matches the dependency's group:artifact:key.","If using a BOM, verify it is listed under dependencyManagement with scope=import and that the import itself resolves."],"exampleFix":"// before\nDependency d = Dependency.of(\"io.quarkus\", \"quarkus-arc\"); // no version\n// after\nDependency d = Dependency.of(\"io.quarkus\", \"quarkus-arc\", \"3.15.0\");\n// or add a constraint:\nmodule.addDirectDependencyConstraint(Dependency.of(\"io.quarkus\", \"quarkus-bom\", \"3.15.0\").asPomDependency().withScope(\"import\"));","handlingStrategy":"validation","validationCode":"for (var d : module.getDirectDependencies()) {\n    boolean managed = module.getDirectDependencyConstraints().stream()\n        .anyMatch(c -> c.getKey().equals(d.getKey()) || c.getScope().equals(\"import\"));\n    if (d.getVersion() == null && !managed) {\n        throw new IllegalStateException(\"Dependency \" + d.getKey() + \" has no version and no matching constraint\");\n    }\n}","typeGuard":"static boolean hasResolvableVersion(io.quarkus.maven.dependency.Dependency d) {\n    return d.getVersion() != null || d.getType().equals(\"pom\"); // BOM imports may omit version handling elsewhere\n}","tryCatchPattern":"try {\n    model = resolver.resolveModel(module);\n} catch (AppModelResolverException e) {\n    if (e.getMessage().contains(\"is missing version\")) {\n        throw new IllegalStateException(\"Add a version or a dependencyManagement entry for: \" + e.getMessage(), e);\n    }\n    throw e;\n}","preventionTips":["Always specify a version or import the Quarkus BOM (and any other BOMs) in dependencyManagement.","When constructing WorkspaceModule programmatically, mirror the POM's dependencyManagement into direct dependency constraints.","Run `mvn dependency:tree` (or `mvn validate`) early to catch unversioned dependencies before bootstrap resolution."],"tags":["maven","dependency-management","version","bootstrap"],"backgroundTag":"missing-dependency-version","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}