From 066a4d6c9e4b8394c4b88531788489abb13c58d5 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 20 Aug 2014 20:53:17 +0200 Subject: [PATCH] Add maybeCheckForSnapshotDependencies to build.gradle to check for Snapshot dependencies in release builds. --- build.gradle | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/build.gradle b/build.gradle index daf16bc22..b8840a72b 100644 --- a/build.gradle +++ b/build.gradle @@ -138,6 +138,19 @@ task distributionZip(type: Zip, dependsOn: [javadocAll, prepareReleasedocs, mark } } +task maybeCheckForSnapshotDependencies { + // Don't check for Snapshot dependencies if this is a snapshot. + if (isSnapshot) return + allprojects { project -> + project.configurations.runtime.each { + if (it.toString().contains("-SNAPSHOT")) + throw new Exception("Release build contains snapshot dependencies: " + it) + } + } +} + +test { dependsOn maybeCheckForSnapshotDependencies } + jar { // Root project should not create empty jar artifact enabled = false