From 76c70652a92344ab74fc157fee4165e4e22bf934 Mon Sep 17 00:00:00 2001 From: Andriy Redko Date: Thu, 30 Nov 2023 16:46:30 -0500 Subject: [PATCH] Use only pluginZip publication of Apache Maven artifacts (#226) * Use only pluginZip publication of Apache Maven artifacts Signed-off-by: Andriy Redko * Address code review comments Signed-off-by: Andriy Redko * Address code review comments Signed-off-by: Andriy Redko --------- Signed-off-by: Andriy Redko --- build.gradle | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index 9f8bc9429..58af38301 100644 --- a/build.gradle +++ b/build.gradle @@ -74,6 +74,11 @@ buildscript { } } +allprojects { + // Default to the apache license + project.ext.licenseName = 'The Apache Software License, Version 2.0' + project.ext.licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' +} publishing { publications { @@ -86,23 +91,28 @@ publishing { name = pluginName description = pluginDescription groupId = "org.opensearch.plugin" - licenses { - license { - name = "The Apache License, Version 2.0" - url = "http://www.apache.org/licenses/LICENSE-2.0.txt" - } - } - developers { - developer { - name = "OpenSearch Flow Framework Plugin" - url = "https://github.com/opensearch-project/flow-framework" - } + + withXml { XmlProvider xml -> + Node node = xml.asNode() + node.appendNode('inceptionYear', '2021') + + Node license = node.appendNode('licenses').appendNode('license') + license.appendNode('name', project.licenseName) + license.appendNode('url', project.licenseUrl) + + Node developer = node.appendNode('developers').appendNode('developer') + developer.appendNode('name', 'OpenSearch') + developer.appendNode('url', 'https://github.com/opensearch-project/flow-framework') } } } } repositories { + maven { + name = 'staging' + url = "${rootProject.buildDir}/local-staging-repo" + } maven { name = "Snapshots" url = "https://aws.oss.sonatype.org/content/repositories/snapshots" @@ -261,3 +271,13 @@ diffCoverageReport { failOnViolation = true } } + + +tasks.withType(AbstractPublishToMaven) { + def predicate = provider { + publication.name == "pluginZip" + } + onlyIf("Publishing only ZIP distributions") { + predicate.get() + } +}