【问题标题】: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-publish。 com.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)
}
}
}
}