Skip to content

Commit 6b2a319

Browse files
authored
Migrate CI to sonatype central portal (#731)
1 parent e439fe8 commit 6b2a319

File tree

2 files changed

+9
-22
lines changed

2 files changed

+9
-22
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ plugins {
1515
id 'java'
1616
id 'jacoco'
1717
id 'me.champeau.gradle.japicmp' version '0.2.9'
18+
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
1819
}
1920

2021
repositories {

gradle/maven-publish.gradle

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ artifacts {
2525
archives sourcesJar, javadocJar
2626
}
2727

28-
29-
final releaseRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
30-
final snapshotRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
31-
3228
publishing {
3329
publications {
3430
mavenJava(MavenPublication) {
@@ -68,28 +64,18 @@ publishing {
6864
connection = POM_SCM_CONNECTION
6965
developerConnection = POM_SCM_DEV_CONNECTION
7066
}
71-
72-
pom.withXml {
73-
def dependenciesNode = asNode().appendNode('dependencies')
74-
75-
project.configurations.implementation.allDependencies.each {
76-
def dependencyNode = dependenciesNode.appendNode('dependency')
77-
dependencyNode.appendNode('groupId', it.group)
78-
dependencyNode.appendNode('artifactId', it.name)
79-
dependencyNode.appendNode('version', it.version)
80-
}
81-
}
8267
}
8368
}
8469
}
70+
}
71+
72+
nexusPublishing {
8573
repositories {
86-
maven {
87-
name = "sonatype"
88-
url = version.endsWith('SNAPSHOT') ? snapshotRepositoryUrl : releaseRepositoryUrl
89-
credentials {
90-
username = System.getenv("MAVEN_USERNAME")
91-
password = System.getenv("MAVEN_PASSWORD")
92-
}
74+
sonatype {
75+
nexusUrl.set(uri('https://ossrh-staging-api.central.sonatype.com/service/local/'))
76+
snapshotRepositoryUrl.set(uri('https://central.sonatype.com/repository/maven-snapshots/'))
77+
username.set(System.getenv("MAVEN_USERNAME"))
78+
password.set(System.getenv("MAVEN_PASSWORD"))
9379
}
9480
}
9581
}

0 commit comments

Comments
 (0)