【问题标题】:Building an android library in Jitpack: ERROR: No build artifacts found在 Jitpack 中构建 android 库:错误:未找到构建工件
【发布时间】:2020-07-13 12:42:01
【问题描述】:

我已经创建了一个 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 发布库的新手,所以我可能会遗漏一些东西。有什么线索吗?

【问题讨论】:

标签: android android-studio gradle jitpack


【解决方案1】:

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

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

【讨论】:

    【解决方案2】:

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

    publishing {
      publications {
        create<MavenPublication>("maven") {
          groupId = "com.github.username"
          artifactId = "library-name"
          version = "1.0.0"
    
          from(components["kotlin"])
        }
      }
    }
    

    希望,这会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-04
      • 2021-10-01
      • 1970-01-01
      • 2021-11-01
      • 2015-09-20
      • 1970-01-01
      • 2021-06-28
      • 2016-06-25
      相关资源
      最近更新 更多