Skip to content

Commit

Permalink
Fix task order when releasing to Nexus
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp94831 committed Feb 14, 2024
1 parent 931f0cf commit bf64322
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions sonatype/src/main/kotlin/com/bakdata/gradle/SonatypePlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ class SonatypePlugin : Plugin<Project> {
addParentPublishToNexusTasks()

disallowPublishTasks()

tasks.named("closeRepository") {
mustRunAfter("publishToNexus")
}
}
}

Expand All @@ -91,12 +95,7 @@ class SonatypePlugin : Plugin<Project> {
val parent = project.parent
if (parent != null) {
tasks.matching { it.name == "publishToNexus" }.configureEach {
val parentProvider =
try {
parent.tasks.named("publishToNexus")
} catch (e: UnknownTaskException) {
parent.tasks.register("publishToNexus")
}
val parentProvider = parent.tasks.named("publishToNexus")
this.let { childTask ->
parentProvider.configure {
dependsOn(childTask)
Expand Down

0 comments on commit bf64322

Please sign in to comment.