Is there a way to determine if a dependency is a snapshot?

I’d like a way to ensure that release builds do not depend on snapshots. I’m imagining something like this:

configurations.all {

resolutionStrategy {

//simple way if it was built into gradle


// alternate way

eachDependency { DependencyResolveDetails details ->

if (details.isSnapshot) {

//fail the build





There are several ways to do this. When using ‘eachDependency’, you can check for something like ‘details.requested.version.endsWith("-SNAPSHOT")’.