Enforce no snapshot dependencies in gradle

You could use a dependency resolve rule:

configurations.all {
    resolutionStrategy.eachDependency { details ->
        if (details.requested.version.endsWith("-SNAPSHOT") {
            throw new GradleException("found snapshot dependency")
        }
    }
}

You can learn more about this API in the Gradle Build Language Reference (e.g. starting from ‘Configuration’).

1 Like