From 5d8c59b72767b91686ccc62d3956d8e778e974c0 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Wed, 27 Mar 2024 07:44:20 -0700 Subject: [PATCH] Fix the release build by only applying the Maven publish task to either projects with a name starting with data-prepper or any projects that are children of the data-prepper-plugins project. (#4337) (#4339) Signed-off-by: David Venable (cherry picked from commit 8760945c8091d1dd4e2bb8c66c5bb9f33f0aaa43) Co-authored-by: David Venable --- build.gradle | 70 +++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/build.gradle b/build.gradle index b72014b4c0..c8d0fe1cfa 100644 --- a/build.gradle +++ b/build.gradle @@ -42,46 +42,48 @@ allprojects { } } - project.plugins.withType(JavaPlugin).configureEach { - java { - withJavadocJar() - withSourcesJar() - } + if(project.name.startsWith('data-prepper') || project.parent != null && project.parent.name.equals('data-prepper-plugins')) { + project.plugins.withType(JavaPlugin).configureEach { + java { + withJavadocJar() + withSourcesJar() + } - afterEvaluate { - project.publishing { - repositories { - maven { - url "file://${mavenPublicationRootFile.absolutePath}" + afterEvaluate { + project.publishing { + repositories { + maven { + url "file://${mavenPublicationRootFile.absolutePath}" + } } - } - publications { - mavenJava(MavenPublication) { - from project.components.findByName("java") ?: project.components.findByName("javaLibrary") + publications { + mavenJava(MavenPublication) { + from project.components.findByName("java") ?: project.components.findByName("javaLibrary") - groupId = project.group - artifactId = project.name - version = project.version + groupId = project.group + artifactId = project.name + version = project.version - pom { - name = project.name - description = "Data Prepper project: ${project.name}" - url = 'https://github.com/opensearch-project/data-prepper' - licenses { - license { - name = 'The Apache Software License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution = 'repo' + pom { + name = project.name + description = "Data Prepper project: ${project.name}" + url = 'https://github.com/opensearch-project/data-prepper' + licenses { + license { + name = 'The Apache Software License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + distribution = 'repo' + } } - } - developers { - developer { - name = 'OpenSearch' - url = 'https://github.com/opensearch-project' + developers { + developer { + name = 'OpenSearch' + url = 'https://github.com/opensearch-project' + } + } + scm { + url = 'https://github.com/opensearch-project/data-prepper' } - } - scm { - url = 'https://github.com/opensearch-project/data-prepper' } } }