Skip to content

Commit a62dd98

Browse files
[Backport 2.x] Add publish in spi build.gradle (#1211)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 3bd3756 commit a62dd98

File tree

3 files changed

+62
-1
lines changed

3 files changed

+62
-1
lines changed

.github/workflows/maven-publish.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ jobs:
3232
export SONATYPE_PASSWORD=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-password --query SecretString --output text)
3333
echo "::add-mask::$SONATYPE_USERNAME"
3434
echo "::add-mask::$SONATYPE_PASSWORD"
35-
./gradlew publishPluginZipPublicationToSnapshotsRepository
35+
./gradlew publishPluginZipPublicationToSnapshotsRepository
36+
./gradlew publishShadowPublicationToSnapshotsRepository

build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ publishing {
271271
}
272272
}
273273

274+
tasks.generatePomFileForPluginZipPublication.dependsOn publishNebulaPublicationToMavenLocal
275+
274276
plugins.withId('java') {
275277
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_11
276278
}

spi/build.gradle

+58
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ apply plugin: 'kotlin'
1616
apply plugin: 'org.jetbrains.kotlin.jvm'
1717
apply plugin: 'org.jetbrains.kotlin.plugin.allopen'
1818
apply plugin: 'idea'
19+
apply plugin: 'maven-publish'
1920

2021
ext {
2122
projectSubstitutions = [:]
@@ -83,6 +84,11 @@ tasks.register("sourcesJar", Jar) {
8384
from sourceSets.main.allSource
8485
}
8586

87+
task javadocJar(type: Jar) {
88+
archiveClassifier = 'javadoc'
89+
from javadoc.destinationDir
90+
}
91+
8692
test {
8793
doFirst {
8894
test.classpath -= project.files(project.tasks.named('shadowJar'))
@@ -103,3 +109,55 @@ check.dependsOn integTest
103109
testClusters.javaRestTest {
104110
testDistribution = 'INTEG_TEST'
105111
}
112+
113+
publishing {
114+
repositories {
115+
maven {
116+
name = 'staging'
117+
url = "${rootProject.buildDir}/local-staging-repo"
118+
}
119+
maven {
120+
name = "Snapshots"
121+
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
122+
credentials {
123+
username "$System.env.SONATYPE_USERNAME"
124+
password "$System.env.SONATYPE_PASSWORD"
125+
}
126+
}
127+
}
128+
publications {
129+
shadow(MavenPublication) {
130+
project.shadow.component(it)
131+
132+
artifact sourcesJar
133+
artifact javadocJar
134+
135+
pom {
136+
name = "OpenSearch Index Management SPI"
137+
packaging = "jar"
138+
url = "https://github.com/opensearch-project/index-management"
139+
description = "OpenSearch Index Management SPI"
140+
scm {
141+
connection = "scm:[email protected]:opensearch-project/index-management.git"
142+
developerConnection = "scm:[email protected]:opensearch-project/index-management.git"
143+
url = "[email protected]:opensearch-project/index-management.git"
144+
}
145+
licenses {
146+
license {
147+
name = "The Apache License, Version 2.0"
148+
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
149+
}
150+
}
151+
developers {
152+
developer {
153+
name = "OpenSearch"
154+
url = "https://github.com/opensearch-project/index-management"
155+
}
156+
}
157+
}
158+
}
159+
}
160+
161+
gradle.startParameter.setShowStacktrace(ShowStacktrace.ALWAYS)
162+
gradle.startParameter.setLogLevel(LogLevel.DEBUG)
163+
}

0 commit comments

Comments
 (0)