apereo/cas · error · GradleException
SNAPSHOT versions found in
Error message
SNAPSHOT versions found in ${catalogFile}:
What it means
A build check scans the version catalog (gradle/ libs.versions.toml style catalogFile) line by line and throws GradleException listing any lines containing 'SNAPSHOT' (case-insensitive). CAS forbids SNAPSHOT dependency versions in the catalog to keep reproducible builds.
Solutions
- Replace the SNAPSHOT version in the catalog with a released version (e.g. 2.0.0 instead of 2.0.0-SNAPSHOT).
- For local experiments, use a local maven repo/composite build instead of a snapshot entry, and revert the catalog afterward.
- Use the listed line numbers in the message to locate and fix every offending line.
Example fix
// before (catalog) foo = "3.2.0-SNAPSHOT" // after foo = "3.2.0"
Defensive patterns
Strategy: validation
Validate before calling
// grep the catalog before building grep -i SNAPSHOT gradle/libs.versions.toml && echo "fix snapshot versions" || echo ok
Prevention
- Never commit snapshot versions to the catalog; revert local experiments.
- Add a pre-commit hook that greps the catalog for SNAPSHOT.
- Upgrade via released versions only; use composite builds for local dev iterations.
When it happens
Trigger: Editing the version catalog to temporarily point a library at a -SNAPSHOT version, then running any build that executes this check.
Common situations: Developer pins a dependency to a snapshot for local testing and forgets to revert before building; a dependabot/upgrade PR accidentally introduces a snapshot.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
AI-assisted analysis of apereo/cas@e7288fc434 (2026-09-08).
Data as JSON: /api/errors/0c7205b507eacca1.
Report an issue: GitHub.
Appendix: source
Thrown at build.gradle:391
mongoImportExecutable.set(providers.systemProperty("casModuleMetadataMongoImportExecutable").orElse("mongoimport"))
}
}
tasks.register('verifyDependencyVersions') { t ->
def catalogFile = rootProject.layout.projectDirectory
.file('gradle/libs.versions.toml')
.asFile
inputs.file(catalogFile).withPathSensitivity(PathSensitivity.RELATIVE)
doLast {
def snapshotLines = []
catalogFile.eachLine { line, lineNumber ->
if (line =~ /(?i)SNAPSHOT/) {
snapshotLines << "${lineNumber}: ${line.trim()}"
}
}
if (!snapshotLines.empty) {
throw new GradleException("SNAPSHOT versions found in ${catalogFile}:\n" + snapshotLines.collect { "\t - $it" }.join('\n'))
}
}
}
tasks.named("clean") {
delete new File(project.rootDir, '.gradle/cas-test-tags')
}
View on GitHub (pinned to e7288fc434)