Fix source/doc jar publication
diff --git a/build-logic/src/main/kotlin/PublicationPlugin.kt b/build-logic/src/main/kotlin/PublicationPlugin.kt
index 7752d79..76cd61c 100644
--- a/build-logic/src/main/kotlin/PublicationPlugin.kt
+++ b/build-logic/src/main/kotlin/PublicationPlugin.kt
@@ -26,6 +26,31 @@
                     definedVersion
                 }
 
+            // Create placeholder jars to satisfy Central Portal validation.
+            // See https://central.sonatype.org/publish/requirements/#supply-javadoc-and-sources
+            val readmePath = "$rootDir/gradle/"
+            val sourcePlaceholderJar =
+                tasks.register("sourcePlaceholderJar", Jar::class.java) {
+                    archiveBaseName.set("${localGradleProperty("POM_NAME").get()}")
+                    archiveVersion.set(this@with.version.toString())
+                    archiveClassifier.set("sources")
+                    from(layout.projectDirectory.file("$readmePath/README-sources.md")) {
+                        into("")
+                        rename { "README.md" }
+                    }
+                }
+
+            val docsPlaceholderJar =
+                tasks.register("docsPlaceholderJar", Jar::class.java) {
+                    archiveBaseName.set("${localGradleProperty("POM_NAME").get()}")
+                    archiveVersion.set(this@with.version.toString())
+                    archiveClassifier.set("javadoc")
+                    from(layout.projectDirectory.file("$readmePath/README-javadoc.md")) {
+                        into("")
+                        rename { "README.md" }
+                    }
+                }
+
             extensions.configure<PublishingExtension> {
                 publications {
                     register<MavenPublication>("maven") {
@@ -33,6 +58,9 @@
                         version = version.toString()
                         artifactId = localGradleProperty("POM_ARTIFACT_ID").get()
 
+                        artifact(sourcePlaceholderJar)
+                        artifact(docsPlaceholderJar)
+
                         pom {
                             name.set(localGradleProperty("POM_NAME"))
                             description.set(providers.gradleProperty("POM_DESCRIPTION"))
@@ -117,8 +145,6 @@
                 sign(the<PublishingExtension>().publications["maven"])
                 isRequired = enableSigning && !version.toString().endsWith("SNAPSHOT")
             }
-
-            project.createPlaceholderJarTasks()
         }
 
     // TODO: remove this once https://github.com/gradle/gradle/issues/23572 is fixed
@@ -126,35 +152,4 @@
         provider {
             if (hasProperty(name)) property(name)?.toString() else null
         }
-
-    // Create placeholder jars to satisfy Central Portal validation.
-    // See https://central.sonatype.org/publish/requirements/#supply-javadoc-and-sources
-    private fun Project.createPlaceholderJarTasks() {
-        val readmePath = "$rootDir/gradle/"
-        val sourcePlaceholderJar =
-            tasks.register("sourcePlaceholderJar", Jar::class.java) {
-                archiveBaseName.set("${localGradleProperty("POM_NAME").get()}")
-                archiveVersion.set(this@createPlaceholderJarTasks.version.toString())
-                archiveClassifier.set("sources")
-                from(layout.projectDirectory.file("$readmePath/README-sources.md")) {
-                    into("")
-                    rename { "README.md" }
-                }
-            }
-
-        val docsPlaceholderJar =
-            tasks.register("docsPlaceholderJar", Jar::class.java) {
-                archiveBaseName.set("${localGradleProperty("POM_NAME").get()}")
-                archiveVersion.set(this@createPlaceholderJarTasks.version.toString())
-                archiveClassifier.set("javadoc")
-                from(layout.projectDirectory.file("$readmePath/README-javadoc.md")) {
-                    into("")
-                    rename { "README.md" }
-                }
-            }
-
-        tasks.named("publishMavenPublicationToMavenCentralRepository") {
-            dependsOn(sourcePlaceholderJar, docsPlaceholderJar)
-        }
-    }
 }