apereo/cas · error · GradleException
Unable to determine version for dependency
Error message
Unable to determine version for dependency ${artifact} What it means
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}").
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.
Example fix
// before: dependency used without catalog entry
// after (libs.versions.toml)
[versions]
bcprov = "1.78.1"
[libraries]
bcprov = { module = "org.bouncycastle:bcprov-jdk18on", version.ref = "bcprov" } Defensive patterns
Strategy: validation
Validate before calling
// confirm the artifact resolves a version from catalogs before BOM generation
def key = "${group}@${name}"
assert dependencyVersions.collect { it.keySet() }.flatten().contains(key) : "add ${key} to version catalog" Type guard
static boolean hasCatalogVersion(String group, String name, Map versions) {
return versions.containsKey("${group}@${name}");
} Prevention
- 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.
When it happens
Trigger: createDependency-style BOM generation encounters a dependency whose group:name has no entry (or no strict/resolved version) in any available version catalog.
Common situations: 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.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
AI-assisted analysis of apereo/cas@e7288fc434 (2026-09-08).
Data as JSON: /api/errors/c850ea655b6d68df.
Report an issue: GitHub.
Appendix: source
Thrown at support/cas-server-support-bom/build.gradle:196
}
if (artifact.hasProperty("versionConstraint") && artifact.versionConstraint != null) {
def vc = artifact.versionConstraint
if (vc.requiredVersion) {
return vc.requiredVersion.toString()
}
if (vc.preferredVersion) {
return vc.preferredVersion.toString()
}
if (vc.strictVersion) {
return vc.strictVersion.toString()
}
}
throw new GradleException("Unable to determine version for dependency ${artifact}")
}
static void createDependency(dependencies, group, name, version, dependencyVersions) {
def key = "${group}@${name}"
def dependency = dependencies.appendNode("dependency")
dependency.appendNode("groupId", group)
dependency.appendNode("artifactId", name)
if (name.matches(getProjectNamePattern())) {
dependency.appendNode("version", "\${cas.version}")
dependencyVersions.put("cas.version", version)
} else {
def versionProp = "${group}.${name}.version"
dependency.appendNode("version", String.format("\${%s}", versionProp))
dependencyVersions.put(versionProp, version)
}
}View on GitHub (pinned to e7288fc434)