From 26d44ecb818a1a945d5fea4e4c2a465cb06829ee Mon Sep 17 00:00:00 2001 From: Emil Lundberg Date: Mon, 12 Jul 2021 16:39:29 +0200 Subject: [PATCH] Don't require Nexus secrets to configure publishing metadata --- build.gradle | 73 +++++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/build.gradle b/build.gradle index 544ee2a34..1694b064b 100644 --- a/build.gradle +++ b/build.gradle @@ -219,7 +219,7 @@ subprojects { project -> } } - if (publishEnabled && project.hasProperty('publishMe') && project.publishMe) { + if (project.hasProperty('publishMe') && project.publishMe) { apply plugin: 'maven-publish' apply plugin: 'signing' @@ -266,56 +266,59 @@ subprojects { project -> } } - signing { - useGpgCmd() - sign publishing.publications.jars + if (publishEnabled) { + signing { + useGpgCmd() + sign publishing.publications.jars + } } } + } // The root project has no sources, but the dependency platform also needs to be published as an artifact // See https://docs.gradle.org/current/userguide/java_platform_plugin.html // See https://github.com/Yubico/java-webauthn-server/issues/93#issuecomment-822806951 -if (publishEnabled) { - apply plugin: 'maven-publish' - apply plugin: 'signing' - - publishing { - publications { - jars(MavenPublication) { - from components.javaPlatform - - pom { - name = project.name - description = project.description - url = 'https://developers.yubico.com/java-webauthn-server/' - - developers { - developer { - id = 'emil' - name = 'Emil Lundberg' - email = 'emil@yubico.com' - } +apply plugin: 'maven-publish' +apply plugin: 'signing' + +publishing { + publications { + jars(MavenPublication) { + from components.javaPlatform + + pom { + name = project.name + description = project.description + url = 'https://developers.yubico.com/java-webauthn-server/' + + developers { + developer { + id = 'emil' + name = 'Emil Lundberg' + email = 'emil@yubico.com' } + } - licenses { - license { - name = 'BSD-license' - comments = 'Revised 2-clause BSD license' - } + licenses { + license { + name = 'BSD-license' + comments = 'Revised 2-clause BSD license' } + } - scm { - url = 'scm:git:git://github.com/Yubico/java-webauthn-server.git' - connection = 'scm:git:git://github.com/Yubico/java-webauthn-server.git' - developerConnection = 'scm:git:ssh://git@github.com/Yubico/java-webauthn-server.git' - tag = 'HEAD' - } + scm { + url = 'scm:git:git://github.com/Yubico/java-webauthn-server.git' + connection = 'scm:git:git://github.com/Yubico/java-webauthn-server.git' + developerConnection = 'scm:git:ssh://git@github.com/Yubico/java-webauthn-server.git' + tag = 'HEAD' } } } } +} +if (publishEnabled) { signing { useGpgCmd() sign publishing.publications.jars