Skip to content

Commit c85d1aa

Browse files
committed
Improve publication reliability through Nexus Publishing plugin
1 parent 29690ed commit c85d1aa

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

buildSrc/src/main/kotlin/Dependencies.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ object Plugins {
3737

3838
// Publishing
3939
const val nexusStaging: Lib = "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.22.0"
40+
const val nexusPublishing: Lib = "de.marcphilipp.gradle:nexus-publish-plugin:0.4.0"
4041
}
4142

4243
/**

deployment.gradle

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ final Deployed deployConfig = project.ext.deployConfig
1010
final DeployedCredentials deployCredentials = project.ext.deployCredentials
1111
final boolean isAndroid = project.plugins.findPlugin("com.android.library") != null
1212

13-
apply plugin: "maven-publish"
13+
apply plugin: "de.marcphilipp.nexus-publish"
1414
apply plugin: "signing"
1515
apply plugin: "org.jetbrains.dokka"
1616

@@ -126,9 +126,20 @@ nexusStaging {
126126
password = deployCredentials.ossrhPassword
127127
}
128128

129+
nexusPublishing {
130+
repositories {
131+
sonatype {
132+
username = deployCredentials.ossrhUsername
133+
password = deployCredentials.ossrhPassword
134+
}
135+
}
136+
}
137+
129138
// Catch-all deployment task for multiple modules
130-
def deploy = tasks.maybeCreate("deploy")
131-
deploy.finalizedBy "publishReleasePublicationToCentralRepository"
139+
def deployTask = tasks.maybeCreate("deploy")
140+
def publishTask = tasks.getByName("publishToSonatype")
141+
142+
deployTask.finalizedBy(publishTask)
132143
if (!isSnapshot) {
133-
deploy.finalizedBy "closeAndReleaseRepository"
144+
publishTask.finalizedBy(":closeAndReleaseRepository")
134145
}

instrumentation/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ buildscript {
66
mavenCentral()
77
jcenter()
88
jitpack()
9+
gradlePluginPortal()
910
}
1011
dependencies {
1112
classpath(Plugins.kotlin)
1213
classpath(Plugins.android.dependency)
1314
classpath(Plugins.versions)
1415
classpath(Plugins.dokkaCore)
1516
classpath(Plugins.nexusStaging)
17+
classpath(Plugins.nexusPublishing)
1618
}
1719
}
1820

plugin/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ buildscript {
66
mavenCentral()
77
jcenter()
88
jitpack()
9+
gradlePluginPortal()
910
}
1011
dependencies {
1112
classpath(Plugins.kotlin)
1213
classpath(Plugins.versions)
1314
classpath(Plugins.dokkaCore)
1415
classpath(Plugins.nexusStaging)
16+
classpath(Plugins.nexusPublishing)
1517
classpath(Plugins.shadow)
1618
}
1719
}

0 commit comments

Comments
 (0)