【问题标题】:Failed to publish Kotlin Library to Jitpack无法将 Kotlin 库发布到 Jitpack
【发布时间】:2021-02-18 15:39:09
【问题描述】:

我创建了一个使用 Apollo 作为其 GraphQL 客户端的 Kotlin 库。我正在尝试将其发布到 Jitpack。我运行 ./gradlew install 命令但构建失败:

Could not publish configuration 'archives'
Cannot publish artifact 'metadata.json' (.../sample/build/generated/metadata/apollo/debugAndroidTest/service/metadata.json)) as it does not exist.

如果需要更多信息,请告诉我。 谢谢!

【问题讨论】:

    标签: android kotlin gradle apollo jitpack


    【解决方案1】:

    希望这可以帮助其他开发者。

    Jitpack 文档未更新。确保您没有使用:

    plugins {
        id 'com.android.library'
        id 'kotlin-android'
        id 'com.apollographql.apollo'
        id 'kotlinx-serialization'
        id 'com.github.dcendents.android-maven' <------
    }
    

    com.github.dcendents.android-maven 替换为maven-publishcom.github.dcendents.android-maven 被标记为已弃用。然后你可以在你的库 build gradle 中将你的配置添加到 public 到 maven。

        afterEvaluate {
            publishing {
                publications {
                    // Creates a Maven publication called "release".
                    release(MavenPublication) {
                        // Applies the component for the release build variant.
                        from components.release
        
                        // You can then customize attributes of the publication as shown below.
                        groupId = 'com.test.sdk.library'
                        artifactId = 'test'
                        version = 0.0.1 //(whatever version you want)
                    }
                }
            }
        }
    

    【讨论】:

      猜你喜欢
      • 2018-09-30
      • 2017-08-15
      • 1970-01-01
      • 1970-01-01
      • 2016-09-25
      • 2018-04-28
      • 2023-04-02
      • 2017-08-19
      • 2022-01-21
      相关资源
      最近更新 更多