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


(William Lichtenberger) #1

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

disableSnapshots()

// alternate way

eachDependency { DependencyResolveDetails details ->

if (details.isSnapshot) {

//fail the build

}

}

}

}


(Peter Niederwieser) #2

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