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/build.gradle b/build.gradle index f353cc48b..0b7bc7dea 100644 --- a/build.gradle +++ b/build.gradle @@ -271,6 +271,8 @@ publishing { } } +tasks.generatePomFileForPluginZipPublication.dependsOn publishNebulaPublicationToMavenLocal + plugins.withId('java') { sourceCompatibility = targetCompatibility = JavaVersion.VERSION_11 } diff --git a/spi/build.gradle b/spi/build.gradle index 0dc7df633..0a247b359 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,55 @@ 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) + + 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) +}