在Jitpack中构建android库:错误:未找到构建工件

时间:2020-07-13 12:42:01

标签: android android-studio gradle jitpack

我创建了一个Android库并合并了一些我需要的更改 https://github.com/ceessay/kdgaugeView

为了在我的Android项目中使用该库,我尝试将其发布在Jitpack上。

问题是在Github上进行更改后,Jitpack上的构建似乎通过了,但是有此消息

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 543ms
4 actionable tasks: 1 executed, 3 up-to-date
Build tool exit code: 0
Looking for artifacts...
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Looking for pom.xml in build directory and ~/.m2
2020-07-13T12:27:13.425592193Z
Exit code: 0
ERROR: No build artifacts found

完整日志在这里:https://jitpack.io/com/github/ceessay/kdgaugeView/1.0.5/build.log

在我的项目中添加库也失败,并显示以下消息:

找不到com.github.ceessay:kdgaugeView:1.0.4。

我遵循了Jitpack文档中的指南,在库中升级了gradle,但我无法使用。

我是发布Android库的新手,所以我可能会缺少一些东西。有什么线索吗?

2 个答案:

答案 0 :(得分:0)

对我来说,最简单的方法是使用 maven-publish gradle 插件。

我确信也可以使用该项目中已经存在的 com.github.dcendents.android-maven,但对我来说并不那么明显。 maven-publish 的文档是 https://developer.android.com/studio/build/maven-publish-plugin

答案 1 :(得分:0)

花了半天时间解决同样的问题。我忘了在 build.gradle.kts 中为我的工件定义发布:

publishing {
  publications {
    create<MavenPublication>("maven") {
      groupId = "com.github.username"
      artifactId = "library-name"
      version = "1.0.0"

      from(components["kotlin"])
    }
  }
}

希望,这会有所帮助。