From a37de2ddd1638cacd27382737b20ae1fc6e44e23 Mon Sep 17 00:00:00 2001 From: nathan Date: Mon, 27 Aug 2018 23:11:53 +0200 Subject: [PATCH] Fixed issue when custom build props are not available --- build.gradle | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index f4f1a5e..ca9fafb 100644 --- a/build.gradle +++ b/build.gradle @@ -19,12 +19,18 @@ import java.time.Instant buildscript { // load properties from custom location - def propsFile = Paths.get("${projectDir}/../../gradle.properties").toAbsolutePath().normalize().toFile() - println("Loading custom property data from: ${propsFile}") + def propsFile = Paths.get("${projectDir}/../../gradle.properties").normalize().toFile() + if (propsFile.canRead()) { + println("Loading custom property data from: ${propsFile}") - def props = new Properties() - propsFile.withInputStream {props.load(it)} - props.each {key, val -> project.ext.set(key, val)} + def props = new Properties() + propsFile.withInputStream {props.load(it)} + props.each {key, val -> project.ext.set(key, val)} + } + else { + ext.sonatypeUsername = "" + ext.sonatypePassword = "" + } // for plugin publishing and license sources repositories {