diff --git a/sonatype/src/main/kotlin/com/bakdata/gradle/SonatypePlugin.kt b/sonatype/src/main/kotlin/com/bakdata/gradle/SonatypePlugin.kt index d65302e..46f92e0 100644 --- a/sonatype/src/main/kotlin/com/bakdata/gradle/SonatypePlugin.kt +++ b/sonatype/src/main/kotlin/com/bakdata/gradle/SonatypePlugin.kt @@ -77,11 +77,9 @@ class SonatypePlugin : Plugin { } } - if (tasks.findByName("publishToNexus") == null) { - tasks.register("publishToNexus") - } + val publishToNexus = tasks.findByName("publishToNexus") ?: tasks.create("publishToNexus") tasks.named("closeRepository") { - mustRunAfter("publishToNexus") + mustRunAfter(publishToNexus) } addParentPublishToNexusTasks()