android - 无法将 Kotlin 库发布到 Jitpack
问题描述
我创建了一个使用 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.
如果需要更多信息,请告诉我。谢谢!
解决方案
希望这可以帮助其他开发人员。
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
被标记为已弃用。然后你可以在你的库构建 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)
}
}
}
}
推荐阅读
- javascript - 将 json 对象返回给渲染方法 - React.js
- c - 共享内存段:如何调整它的大小?
- python - Django 显示不同的模型/标签
- javascript - Javascript 不会输出到 HTML
- r - tabItem 不显示 R 闪亮
- date - 如何将日期时间转换为erlang中的日期名称和月份名称?
- google-apps-script - 带有谷歌电子表格的 OnEdit 函数脚本
- python-3.x - GUI中的基本计算器
- powerquery - 自定义列电源查询编辑器 - 过滤器
- java - Swing JTextField 文本更改侦听器 DocumentListener 无限循环