From f0f18c6250a283cde349052b1dd7e7afc941a786 Mon Sep 17 00:00:00 2001 From: bowenlan-amzn Date: Wed, 17 Jul 2024 16:10:16 -0700 Subject: [PATCH 1/3] Add publish in spi build.gradle Signed-off-by: bowenlan-amzn --- .github/workflows/maven-publish.yml | 3 +- spi/build.gradle | 60 +++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index 8b7b1164b..5e947b345 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -32,4 +32,5 @@ jobs: export SONATYPE_PASSWORD=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-password --query SecretString --output text) echo "::add-mask::$SONATYPE_USERNAME" echo "::add-mask::$SONATYPE_PASSWORD" - ./gradlew publishPluginZipPublicationToSnapshotsRepository \ No newline at end of file + ./gradlew publishPluginZipPublicationToSnapshotsRepository + ./gradlew publishShadowPublicationToSnapshotsRepository \ No newline at end of file diff --git a/spi/build.gradle b/spi/build.gradle index 2fa3f6bf7..5c510b707 100644 --- a/spi/build.gradle +++ b/spi/build.gradle @@ -16,6 +16,7 @@ apply plugin: 'kotlin' apply plugin: 'org.jetbrains.kotlin.jvm' apply plugin: 'org.jetbrains.kotlin.plugin.allopen' apply plugin: 'idea' +apply plugin: 'maven-publish' ext { projectSubstitutions = [:] @@ -83,6 +84,11 @@ tasks.register("sourcesJar", Jar) { from sourceSets.main.allSource } +task javadocJar(type: Jar) { + archiveClassifier = 'javadoc' + from javadoc.destinationDir +} + test { doFirst { test.classpath -= project.files(project.tasks.named('shadowJar')) @@ -103,3 +109,57 @@ check.dependsOn integTest testClusters.javaRestTest { testDistribution = 'INTEG_TEST' } + +publishing { + repositories { + maven { + name = 'staging' + url = "${rootProject.buildDir}/local-staging-repo" + } + maven { + name = "Snapshots" + url = "https://aws.oss.sonatype.org/content/repositories/snapshots" + credentials { + username "$System.env.SONATYPE_USERNAME" + password "$System.env.SONATYPE_PASSWORD" + } + } + } + publications { + shadow(MavenPublication) { + project.shadow.component(it) + groupId = 'org.opensearch.opensearch-index-management' + artifactId = 'opensearch-index-management-spi' + + artifact sourcesJar + artifact javadocJar + + pom { + name = "OpenSearch Index Management SPI" + packaging = "jar" + url = "https://github.com/opensearch-project/index-management" + description = "OpenSearch Index Management SPI" + scm { + connection = "scm:git@github.com:opensearch-project/index-management.git" + developerConnection = "scm:git@github.com:opensearch-project/index-management.git" + url = "git@github.com:opensearch-project/index-management.git" + } + licenses { + license { + name = "The Apache License, Version 2.0" + url = "http://www.apache.org/licenses/LICENSE-2.0.txt" + } + } + developers { + developer { + name = "OpenSearch" + url = "https://github.com/opensearch-project/index-management" + } + } + } + } + } + + gradle.startParameter.setShowStacktrace(ShowStacktrace.ALWAYS) + gradle.startParameter.setLogLevel(LogLevel.DEBUG) +} From b7e279cc84e9c453d2fe35dab0fe9a0494ad0c8f Mon Sep 17 00:00:00 2001 From: bowenlan-amzn Date: Wed, 17 Jul 2024 16:34:36 -0700 Subject: [PATCH 2/3] Directly publish as spi, not user index management Signed-off-by: bowenlan-amzn --- spi/build.gradle | 2 -- 1 file changed, 2 deletions(-) diff --git a/spi/build.gradle b/spi/build.gradle index 5c510b707..3520a964a 100644 --- a/spi/build.gradle +++ b/spi/build.gradle @@ -128,8 +128,6 @@ publishing { publications { shadow(MavenPublication) { project.shadow.component(it) - groupId = 'org.opensearch.opensearch-index-management' - artifactId = 'opensearch-index-management-spi' artifact sourcesJar artifact javadocJar From af46e2771502cc092058bddb22b4da0446268397 Mon Sep 17 00:00:00 2001 From: bowenlan-amzn Date: Thu, 18 Jul 2024 09:47:39 -0700 Subject: [PATCH 3/3] fix broken publishToMavenLocal in the root project reference: https://github.com/opensearch-project/job-scheduler/pull/586 Signed-off-by: bowenlan-amzn --- build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.gradle b/build.gradle index 56e49f2ea..6ed9b7091 100644 --- a/build.gradle +++ b/build.gradle @@ -271,6 +271,8 @@ publishing { } } +tasks.generatePomFileForPluginZipPublication.dependsOn publishNebulaPublicationToMavenLocal + plugins.withId('java') { sourceCompatibility = targetCompatibility = JavaVersion.VERSION_11 }