Skip to content

Commit 061e8f0

Browse files
authored
maven central release with nexux plugin (#961)
1 parent 72a1fda commit 061e8f0

File tree

5 files changed

+28
-36
lines changed

5 files changed

+28
-36
lines changed

Diff for: .ci/configure_signing.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ signing.keyId=${signing_key: -8}
4646
signing.password=${signing_password}
4747
signing.secretKeyRingFile=${keyring_file}
4848
49-
ossrhUsername=${maven_username}
50-
ossrhPassword=${maven_password}
49+
sonatypeUsername=${maven_username}
50+
sonatypePassword=${maven_password}
5151
EOF
52-

Diff for: .ci/make.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ if [[ "$CMD" == "release" ]]; then
193193

194194
if [[ "$DRY_RUN" = "true" ]]; then
195195
echo "Dry run: building and publishing to the local repository"
196-
gradle_task="java-client:publishAllPublicationsToBuildRepository"
196+
gradle_task="publishAllPublicationsToDryRunRepository"
197197
else
198198
echo "Releasing to Maven snapshot repo"
199-
gradle_task="java-client:publishAllPublicationsToMavenCentralRepository"
199+
gradle_task="publishToSonatype closeAndReleaseStagingRepositories"
200200
fi
201201
docker run --rm --env VERSION=$VERSION -u "$(id -u)" \
202202
$git_mount $src_mount $output_mount \

Diff for: build.gradle.kts

+21
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,27 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19+
plugins {
20+
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
21+
}
22+
23+
nexusPublishing {
24+
repositories {
25+
sonatype()
26+
}
27+
}
28+
29+
repositories {
30+
mavenCentral()
31+
}
32+
33+
group = "co.elastic.clients"
34+
description = "Maven central release of the official elasticsearch java client"
35+
36+
subprojects {
37+
group = rootProject.group
38+
version = rootProject.version
39+
}
1940

2041
allprojects {
2142
group = "co.elastic.clients"

Diff for: java-client/build.gradle.kts

+2-16
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ import java.io.FileWriter
2525
plugins {
2626
java
2727
`java-library`
28-
checkstyle
2928
`maven-publish`
29+
publishing
30+
checkstyle
3031
signing
3132
id("com.github.jk1.dependency-license-report") version "2.2"
3233
id("de.thetaphi.forbiddenapis") version "3.4"
@@ -129,21 +130,6 @@ publishing {
129130
name = "Build"
130131
url = uri("${rootProject.buildDir}/repository")
131132
}
132-
133-
maven {
134-
name = "MavenCentral"
135-
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
136-
credentials {
137-
run {
138-
if (gradle.startParameter.taskNames.find { it.contains("ToMavenCentralRepository") } != null) {
139-
if (!providers.gradleProperty("ossrhUsername").isPresent) logger.error("ossrhUsername not set")
140-
if (!providers.gradleProperty("ossrhPassword").isPresent) logger.error("ossrhPassword not set")
141-
}
142-
}
143-
username = providers.gradleProperty("ossrhUsername").orNull
144-
password = providers.gradleProperty("ossrhPassword").orNull
145-
}
146-
}
147133
}
148134

149135
publications {

Diff for: settings.gradle.kts

+1-15
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,4 @@ import java.nio.file.Paths
2121

2222
rootProject.name = "elasticsearch-java"
2323

24-
// Include as subprojects all subdirectories that have a "build.gradle.kts" and no ".gradle-standalone"
25-
fun listFiles(dir: File){
26-
(dir.listFiles() ?: arrayOf<File>()).
27-
filter { File(it, "build.gradle.kts").exists() }.
28-
filter { !File(it, ".gradle-standalone").exists() }.
29-
filter { it.name != "buildSrc" }.
30-
toTypedArray().
31-
forEach { dir ->
32-
include(dir.name)
33-
project(":" + dir.name).projectDir = dir
34-
}
35-
}
36-
37-
listFiles(rootProject.projectDir)
38-
listFiles(Paths.get(rootProject.projectDir.path,"examples").toFile())
24+
include("java-client")

0 commit comments

Comments
 (0)