【问题标题】:Can't add android library to JCenter无法将 android 库添加到 JCenter
【发布时间】:2019-05-17 02:30:33
【问题描述】:

我正在尝试使用 Bintray 将库发布到 JCenter,根据这篇文章:https://medium.com/@anitaa_1990/6-easy-steps-to-upload-your-android-library-to-bintray-jcenter-59e6030c8890

我已成功将库添加到Bintray,但是当我单击“添加到 JCenter”按钮并发送撰写消息时 - 我收到 错误

发送消息失败:包应包含源作为包的一部分。

请告诉我我做错了什么?

【问题讨论】:

标签: android lib bintray jcenter


【解决方案1】:

您的 Bintray Maven 包不包含 sources,仅包含 .aar.pomblog post 中的 未链接到 JCenter,请参阅博客的 package here

Bintray 的 wiki 声明您必须包含 sources

我会使用 blog postthis one,这些包实际上链接到 JCenter。

【讨论】:

    【解决方案2】:

    对于今天到达这里的开发人员,请确保您的配置文件在publishing{} 中有artifact(sourcesJar.get()),如下面的这些行(不完整的build.gradle.kts)。

    val sourcesJar by tasks.registering(Jar::class) {
        classifier = "sources"
        from(sourceSets.main.get().allSource)
    }
    
    publishing {
      publications {
        create<MavenPublication>("default") {
          from(components["java"])
            artifact(dokkaJar)
        }
      }
    
      publications.invoke {
        publicationName(MavenPublication::class) {
          artifactId = artifactID
          artifact(sourcesJar.get()) // This line
        }
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-14
      • 2019-03-01
      • 2016-08-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多