Skip to content

Cannot add sources and javadoc to gradlePluginPublication #25

@mpetuska

Description

@mpetuska

I get this error when trying to add sources and docs to the publication

Execution failed for task ':publishCentralPortalPluginMavenClonePublicationToCentralPortalStorageRepository'.
> Failed to publish publication 'centralPortalPluginMavenClone' to repository 'centralPortalStorage'
   > Invalid publication 'centralPortalPluginMavenClone': multiple artifacts with the identical extension and classifier ('jar.asc', 'sources').

Config file is as follows

@file:Suppress("UnstableApiUsage")

gradlePlugin {
  website = "xxx"
  vcsUrl = "xxx"
  plugins {
    create("xxx") {
      // ...
    }
  }
}

tasks {
  register<Jar>("javadocJar") {
    from(dokkatooGeneratePublicationHtml)
    archiveClassifier = "javadoc"
  }
  whenTaskAdded {
    // Needed to bypass missing task dependency declarations of the MavenDeployer
    if (name.contains("CentralPortal", ignoreCase = true) || name.contains("Github", ignoreCase = true)) {
      dependsOn("javadocJar", "sourcesJar", "jar")
    }
  }
}

deployer {
  content {
    gradlePluginComponents {
      sources(
        artifact = tasks.named("sourcesJar"),
        builtBy = tasks.named("sourcesJar"),
      )
      docs(
        artifact = tasks.named("javadocJar"),
        builtBy = tasks.named("javadocJar"),
      )
    }
  }
}

Any workarounds until the fix is released?

P.S. Publishing with empty source and javadoc jars work just fine (default configuration of gradlePluginComponents).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions