From 684ae26cf70234ead596d73756b0064797f7edd8 Mon Sep 17 00:00:00 2001 From: Goooler Date: Sun, 11 Aug 2024 08:41:44 +0800 Subject: [PATCH] Fix local.properties not found --- publish-root.gradle | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/publish-root.gradle b/publish-root.gradle index ecbba45..cd43973 100644 --- a/publish-root.gradle +++ b/publish-root.gradle @@ -6,9 +6,12 @@ ext["ossrhUsername"] = '' ext["ossrhPassword"] = '' ext["sonatypeStagingProfileId"] = '' -// Read local.properties file first if it exists Properties p = new Properties() -new FileInputStream("local.properties").withCloseable { is -> p.load(is) } +def localPropertiesFile = file("local.properties") +// Read local.properties file if it exists +if (localPropertiesFile.exists()) { + p.load(localPropertiesFile.newInputStream()) +} p.each { name, value -> ext[name] = value } // Set up Sonatype repository