JitPack不会使用GitHub回购 - 包含示范问题的样本回购 [英] JitPack won't use a GitHub repo - included sample repo that demonstrates the issue

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

问题描述

每当我尝试分叉Android库并通过JitPack使用它时,我都会遇到错误,放弃并选择一些其他方法来定制和使用库。这次我想深入了解这一点,并创建了一个隔离问题的基本应用程序。你能否下载下面的回购协议,并告诉我我在做什么错了?

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

  compile'c​​om.github.ArthurHub:android-image-cropper:2.4.5'

Gradle同步很好,但android-image-cropper-2.4.5在项目视图的外部库下不显示。因此,应用程序不会生成这个错误:

 错误:(6,38)错误:package com.theartofdev。 edmodo.cropper不存在

正如我在应用程序 build.gradle ,使用没有JitPack的库就像这样工作得很好:

  compile'c​​om.theartofdev.edmodo:android-image-cropper:2.4.5'

我想也许JitPack无法建立这个回购。但是,此存储库的JitPack日志显示好。

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

 > C:\ Program Files \Android\Android Studio\jre\bin\java.exe-version 
openjdk version1.8.0_112-release
OpenJDK Runtime Environment(build 1.8.0_112-release-b06)
OpenJDK 64位服务器虚拟机(构建25.112-b06,混合模式)

Android Studio中没有未完成的更新。

你能否下载并建立这个回购站点来隔离问题并告诉我我做错了什么?同样,演示此问题的存储库位于以下位置: https://github.com/gazialankus/JitpackNotWorking



谢谢。

编辑:尝试用我的一个叉子试图让库更多JitPack-友好,还是同样的问题。请参阅回购中的提交。



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

解决方案

我认为问题在于组和版本。

编译日志中,您可以看到在Gradle调用中包含 -Pgroup = com.github.ArthurHub -Pversion = 2.4.5 。但在日志中也可以看到找到工件:com.theartofdev.edmodo:android-image-cropper:2.4.5-SNAPSHOT 它实际上应该是找到artifact:com.github.ArthurHub:android-image-cropper:2.4.5



您还可以在文件列表中看到在只有POM生产的日志底部,没有罐子或罐子。这也是为什么Gradle同步在AS中成功的原因,因为依赖关系pom被发现并且是​​有效的,这个依赖关系中没有任何人为因素。



如果您查看构建.gradle of the project you,你可以看到他们没有使用 group version 来配置出版物,所以没有使用JitPack设置的内容,因此无法找到。



只要JitPack没有变得更智能,而不是仅仅只是JitPack兼容设置一些项目变量会添加一些初始化脚本来重新配置发布或类似的东西。



也许你应该使用复合构建。使用复合构建,你可以声明一个像 com.theartofdev.edmodo:android-image-cropper:2.4.5 这样的二进制依赖项,但是这个依赖项被工作树项目和子构建会自动完成以获取依赖关系的工件。这是纯粹的Gradle方法,用自定义构建版本替换依赖项。


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?

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 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

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'

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

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)

There are no pending updates in Android Studio.

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

Thank you.

Edit: 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.

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

解决方案

I think the problem is the group and version.

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.

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.

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.

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.

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天全站免登陆