Skip to content

Commit bf64322

Browse files
committed
Fix task order when releasing to Nexus
1 parent 931f0cf commit bf64322

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

sonatype/src/main/kotlin/com/bakdata/gradle/SonatypePlugin.kt

+5-6
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ class SonatypePlugin : Plugin<Project> {
8080
addParentPublishToNexusTasks()
8181

8282
disallowPublishTasks()
83+
84+
tasks.named("closeRepository") {
85+
mustRunAfter("publishToNexus")
86+
}
8387
}
8488
}
8589

@@ -91,12 +95,7 @@ class SonatypePlugin : Plugin<Project> {
9195
val parent = project.parent
9296
if (parent != null) {
9397
tasks.matching { it.name == "publishToNexus" }.configureEach {
94-
val parentProvider =
95-
try {
96-
parent.tasks.named("publishToNexus")
97-
} catch (e: UnknownTaskException) {
98-
parent.tasks.register("publishToNexus")
99-
}
98+
val parentProvider = parent.tasks.named("publishToNexus")
10099
this.let { childTask ->
101100
parentProvider.configure {
102101
dependsOn(childTask)

0 commit comments

Comments
 (0)