Skip to content

Commit

Permalink
fix: generate a maven publication only for components with variants
Browse files Browse the repository at this point in the history
  • Loading branch information
DanySK committed Dec 7, 2024
1 parent da9c44c commit 487e50c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -43,7 +44,7 @@ class PublishOnCentral : Plugin<Project> {
project.tasks.matching { it.name == "assemble" }.configureEach {
it.dependsOn(sourcesJarTask, javadocJarTask)
}
project.components.configureEach { component ->
project.components.withType<ComponentWithVariants>().configureEach { component ->
publications { publications ->
val name = "${component.name}$PUBLICATION_NAME"
if (publications.none { it.name == name }) {
Expand Down

0 comments on commit 487e50c

Please sign in to comment.