{"record":{"id":"c850ea655b6d68df","repo":"apereo/cas","slug":"unable-to-determine-version-for-dependency-artif","errorCode":null,"errorMessage":"Unable to determine version for dependency ${artifact}","messagePattern":"Unable to determine version for dependency (.+?)","errorType":"console","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"support/cas-server-support-bom/build.gradle","lineNumber":196,"sourceCode":"        }\n\n        if (artifact.hasProperty(\"versionConstraint\") && artifact.versionConstraint != null) {\n            def vc = artifact.versionConstraint\n\n            if (vc.requiredVersion) {\n                return vc.requiredVersion.toString()\n            }\n\n            if (vc.preferredVersion) {\n                return vc.preferredVersion.toString()\n            }\n\n            if (vc.strictVersion) {\n                return vc.strictVersion.toString()\n            }\n        }\n\n        throw new GradleException(\"Unable to determine version for dependency ${artifact}\")\n    }\n\n    static void createDependency(dependencies, group, name, version, dependencyVersions) {\n        def key = \"${group}@${name}\"\n        def dependency = dependencies.appendNode(\"dependency\")\n        dependency.appendNode(\"groupId\", group)\n        dependency.appendNode(\"artifactId\", name)\n\n        if (name.matches(getProjectNamePattern())) {\n            dependency.appendNode(\"version\", \"\\${cas.version}\")\n            dependencyVersions.put(\"cas.version\", version)\n        } else {\n            def versionProp = \"${group}.${name}.version\"\n\n            dependency.appendNode(\"version\", String.format(\"\\${%s}\", versionProp))\n            dependencyVersions.put(versionProp, version)\n        }\n    }","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/apereo/cas/blob/e7288fc434b4f4505b8452e1a57e8fb3111bb863/support/cas-server-support-bom/build.gradle#L178-L214","documentation":"When generating the CAS BOM pom.xml, a helper resolves each artifact's version from the loaded version catalogs (looking up version catalog version constraints); if no version (including strict versions) can be determined for an artifact, it throws GradleException(\"Unable to determine version for dependency ${artifact}\").","triggerScenarios":"createDependency-style BOM generation encounters a dependency whose group:name has no entry (or no strict/resolved version) in any available version catalog.","commonSituations":"A new dependency added to a module is missing from the version catalog; artifact notation typos (wrong group/name) so the catalog lookup key doesn't match; version declared without strictVersion in the catalog.","solutions":["Add the dependency's version to the appropriate version catalog under the matching group@name key.","Fix group/name typos in the dependency so the lookup key matches the catalog entry.","Ensure the catalog version entry is a concrete (strict) version, not an unresolved placeholder.","Verify the version catalog files are actually loaded/registered in the build before BOM generation."],"exampleFix":"// before: dependency used without catalog entry\n// after (libs.versions.toml)\n[versions]\nbcprov = \"1.78.1\"\n[libraries]\nbcprov = { module = \"org.bouncycastle:bcprov-jdk18on\", version.ref = \"bcprov\" }","handlingStrategy":"validation","validationCode":"// confirm the artifact resolves a version from catalogs before BOM generation\ndef key = \"${group}@${name}\"\nassert dependencyVersions.collect { it.keySet() }.flatten().contains(key) : \"add ${key} to version catalog\"","typeGuard":"static boolean hasCatalogVersion(String group, String name, Map versions) {\n    return versions.containsKey(\"${group}@${name}\");\n}","tryCatchPattern":null,"preventionTips":["Add every new third-party dependency to the version catalog in the same PR.","Use only catalog aliases (libs.*) when declaring dependencies, never hardcoded notations.","Keep group/name exactly matching the catalog entry to avoid lookup misses."],"tags":["gradle","bom","version-catalog","dependency-resolution"],"backgroundTag":"missing-dependency","analyzedSha":"e7288fc434b4f4505b8452e1a57e8fb3111bb863","analyzedAt":"2026-09-08T15:39:16.015Z","contentChangedAt":"2026-09-08T15:39:16.015Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}