JitPack 不会使用 GitHub 存储库 - 包含演示问题的示例存储库 [英] JitPack won't use a GitHub repo - included sample repo that demonstrates the issue

查看:21
本文介绍了JitPack 不会使用 GitHub 存储库 - 包含演示问题的示例存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我尝试 fork 一个 Android 库并通过 JitPack 使用它时,我都会出错,放弃并选择其他一些方式来自定义和使用该库.这次我想深入了解并创建了一个隔离问题的基本应用程序.你能下载下面的 repo 并告诉我我做错了什么吗?

Every time I try to fork an Android library and use it through JitPack, I get errors, give up and choose some other means to customize and use the library. This time I wanted to get to the bottom of this and created a basic app that isolates the problem. Could you download the repo below and tell me what the I'm doing wrong?

在这个 repo 中是一个非常基本的 Android 应用程序:https://github.com/gazialankus/JitpackNotWorking.我只是在 Android Studio 中创建了一个新的 Android 应用程序,然后按照 https://jitpack.io/ 中的说明进行操作添加 https://github.com/ArthurHub/Android-Image-Cropper github回购作为依赖.我在根目录中添加了 JitPack Maven 存储库 build.gradle并在应用程序中添加了库依赖项 build.gradle 像这样:

In this repo is a very basic Android application: https://github.com/gazialankus/JitpackNotWorking. I simply created a new Android application in Android Studio, and followed the instructions in https://jitpack.io/ to add the https://github.com/ArthurHub/Android-Image-Cropper github repo as a dependency. I added the JitPack Maven repository in the root build.gradle and added the library dependency in the app build.gradle like this:

compile 'com.github.ArthurHub:android-image-cropper:2.4.5'

Gradle 同步正常,但 android-image-cropper-2.4.5 未显示在项目视图中的外部库下.因此,该应用程序不会因此错误而构建:

Gradle syncs fine, but android-image-cropper-2.4.5 does not show up under external libraries in project view. So, the app won't build with this error:

Error:(6, 38) error: package com.theartofdev.edmodo.cropper does not exist

正如我在构建的评论中所指出的.gradle,像这样使用没有 JitPack 的库就可以了:

As I noted in the comments in the app build.gradle, using the library without JitPack like this works just fine:

compile 'com.theartofdev.edmodo:android-image-cropper:2.4.5'

我想也许 JitPack 无法构建这个 repo.但是,此存储库的 JitPack 日志 说好的".

I thought maybe JitPack could not build this repo. However, the JitPack log for this repository says "ok".

Gradle 和 Java 版本:在 Android Studio 菜单 File > Project Structure > Project 中,Gradle 版本为 3.3,Android Plugin 版本为 2.3.3.在同一个对话框中,SDK Location 选项卡显示正在使用 C:\Program Files\Android\Android Studio\jre 中的嵌入式 JDK.

Gradle and Java versions: In Android Studio menu File > Project Structure > Project, the Gradle version is 3.3 and the Android Plugin Version is 2.3.3. In the same dialog, SDK Location tab shows that embedded JDK is being used from C:\Program Files\Android\Android Studio\jre.

> "C:\Program Files\Android\Android Studio\jre\bin\java.exe" -version 
openjdk version "1.8.0_112-release"
OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
OpenJDK 64-Bit Server VM (build 25.112-b06, mixed mode)

Android Studio 中没有待处理的更新.

There are no pending updates in Android Studio.

能否请您下载并构建此存储库以隔离问题并告诉我我做错了什么?同样,演示问题的存储库在这里:https://github.com/gazialankus/JitpackNotWorking

Could you please download and build this repo that isolates the problem and tell me what I'm doing wrong? Again, the repository that demonstrates the problem is here: https://github.com/gazialankus/JitpackNotWorking

谢谢.

尝试使用我的一个 fork 并尝试使库对 JitPack 更友好,但仍然存在相同的问题.请查看 repo 中的提交.

Tried with a fork of mine and tried to make the library more JitPack-friendly, still the same issue. Please see the commits in the repo.

已解决:请参阅 https://github.com/gazialankus/JitpackNotWorking/blob/master/README.md 了解更多详情.

SOLVED: Please see https://github.com/gazialankus/JitpackNotWorking/blob/master/README.md for more details.

推荐答案

我觉得是组和版本的问题.

I think the problem is the group and version.

构建日志中 您可以看到在 Gradle 调用中包含 -Pgroup=com.github.ArthurHub-Pversion=2.4.5.但也在日志中你看到 Found artifact: com.theartofdev.edmodo:android-image-cropper:2.4.5-SNAPSHOT 它实际上应该是 Found artifact: com.github.ArthurHub:android-image-cropper:2.4.5.

In the build log you can see that in the Gradle call there is contained -Pgroup=com.github.ArthurHub and -Pversion=2.4.5. But also in the log you see Found artifact: com.theartofdev.edmodo:android-image-cropper:2.4.5-SNAPSHOT where it actually should be Found artifact: com.github.ArthurHub:android-image-cropper:2.4.5.

你还可以在日志底部的文件列表中看到只生成了 POM,没有生成 jar 或 aar.这也是 Gradle 同步在 AS 中成功的原因,因为依赖项 pom 已找到且有效,该依赖项没有工件.

You also see in the list of files in the bottom of the log that only the POM is produced, no jar or aar. That's also why the Gradle sync is successful in AS, as the dependencies pom is found and valid, there is just no artifact for that dependency.

如果你查看你所指项目的build.gradle,你可以看到他们没有使用groupversion来配置发布,那又怎样JitPack 已设置未使用,因此无法找到.

If you look at the build.gradle of the project you are referring, you can see that they do not use group and version for configution the publication, so what JitPack has set is not used and thus cannot be found.

只要 JitPack 没有变得更智能,该项目就与 JitPack 不兼容,而不仅仅是设置一些项目变量,而是添加了一些重新配置发布或类似内容的 init 脚本.

That project simply is not JitPack compatible as long as JitPack does not get more intelligent and instead of just setting some project variables adds some init script that reconfigures publications or something like that.

也许您应该改用复合构建.使用复合构建,您将声明一个二进制依赖项,例如 com.theartofdev.edmodo:android-image-cropper:2.4.5,然后用项目的工作树和子构建替换此依赖项自动完成以获取依赖项的工件.这是用自定义构建替换依赖项的纯 Gradle 方式.

Maybe you should use a composite build instead. With a composite build you would declare a binary dependency like com.theartofdev.edmodo:android-image-cropper:2.4.5, but then substitue this dependency by the worktree of the project and a sub-build is automatically done to get the artifact for the dependency. That's the pure Gradle way to replace a dependency with a custom build one.

这篇关于JitPack 不会使用 GitHub 存储库 - 包含演示问题的示例存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆