From aaf2073b5113f06509e68fffff523c60fd1d2674 Mon Sep 17 00:00:00 2001 From: RPJosh Date: Fri, 19 Jan 2024 17:25:25 +0100 Subject: [PATCH] Fix gradle build when not publishing to sonatype and properties are missing --- build.gradle | 9 +++++---- settings.gradle | 9 --------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 23477b0..5faf6c0 100644 --- a/build.gradle +++ b/build.gradle @@ -10,6 +10,7 @@ plugins { version = project.file("./VERSION").text.trim() def version = project.file("./VERSION").text.trim() +def publishToNexus = "publishToSonatype" in gradle.startParameter.taskNames group = "de.rpjosh" @@ -98,8 +99,8 @@ nexusPublishing { snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) // Or use System.getenv? - username=project.property("maven.sonatype.user") - password=project.property("maven.sonatype.password") + username= publishToNexus ? project.property("maven.sonatype.user") : "none" + password= publishToNexus ? project.property("maven.sonatype.password") : "none" } } } @@ -139,8 +140,8 @@ publishing { } signing { - def signingKey = project.property("maven.sonatype.signing.key") - def signingPassword = project.property("maven.sonatype.signing.password") + def signingKey = publishToNexus ? project.property("maven.sonatype.signing.key") : "" + def signingPassword = publishToNexus ? project.property("maven.sonatype.signing.password") : "" useInMemoryPgpKeys(signingKey, signingPassword) // Only sign the publications diff --git a/settings.gradle b/settings.gradle index 70dd66f..89cd875 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,10 +1 @@ -/* - * This file was generated by the Gradle 'init' task. - * - * The settings file is used to specify which projects to include in your build. - * - * Detailed information about configuring a multi-project build in Gradle can be found - * in the user manual at https://docs.gradle.org/6.6.1/userguide/multi_project_builds.html - */ - rootProject.name = 'de.rpjosh.installer'