From 47e6591e74adbeb9b43bb8a834fa676973b3d786 Mon Sep 17 00:00:00 2001
From: dgelessus <dgelessus@users.noreply.github.com>
Date: Thu, 27 Feb 2020 10:48:01 +0100
Subject: [PATCH] Include Sonatype snapshots repo only for snapshot builds

This prevents release builds from accidentally including snapshot
dependencies.
---
 build.gradle | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/build.gradle b/build.gradle
index 182a892..f552d36 100644
--- a/build.gradle
+++ b/build.gradle
@@ -11,6 +11,8 @@ plugins {
 
 version = "1.0.1-SNAPSHOT"
 
+final isSnapshot = project.version.endsWith("-SNAPSHOT")
+
 final SOURCE_ENCODING = "UTF-8"
 
 wrapper {
@@ -20,9 +22,11 @@ wrapper {
 
 repositories {
 	jcenter()
-	maven {
-		name("Sonatype snapshots")
-		url("https://oss.sonatype.org/content/repositories/snapshots")
+	if (isSnapshot) {
+		maven {
+			name("Sonatype snapshots")
+			url("https://oss.sonatype.org/content/repositories/snapshots")
+		}
 	}
 }
 
-- 
GitLab