From 487e50c8510a0246dffcd54806746c2d87cb0414 Mon Sep 17 00:00:00 2001 From: Danilo Pianini Date: Sat, 7 Dec 2024 19:13:17 +0100 Subject: [PATCH] fix: generate a maven publication only for components with variants --- .../org/danilopianini/gradle/mavencentral/PublishOnCentral.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/org/danilopianini/gradle/mavencentral/PublishOnCentral.kt b/src/main/kotlin/org/danilopianini/gradle/mavencentral/PublishOnCentral.kt index 3e0536e9f..5f32fa07d 100644 --- a/src/main/kotlin/org/danilopianini/gradle/mavencentral/PublishOnCentral.kt +++ b/src/main/kotlin/org/danilopianini/gradle/mavencentral/PublishOnCentral.kt @@ -8,6 +8,7 @@ import org.danilopianini.gradle.mavencentral.ProjectExtensions.configureReposito import org.danilopianini.gradle.mavencentral.ProjectExtensions.registerTaskIfNeeded import org.gradle.api.Plugin import org.gradle.api.Project +import org.gradle.api.component.ComponentWithVariants import org.gradle.api.publish.PublishingExtension import org.gradle.api.publish.maven.MavenPublication import org.gradle.api.publish.maven.plugins.MavenPublishPlugin @@ -43,7 +44,7 @@ class PublishOnCentral : Plugin { project.tasks.matching { it.name == "assemble" }.configureEach { it.dependsOn(sourcesJarTask, javadocJarTask) } - project.components.configureEach { component -> + project.components.withType().configureEach { component -> publications { publications -> val name = "${component.name}$PUBLICATION_NAME" if (publications.none { it.name == name }) {