【问题标题】:How to compile from a github repository from Intellij in the build.gradle file?如何在 build.gradle 文件中从 Intellij 的 github 存储库编译?
【发布时间】:2015-10-01 20:54:00
【问题描述】:

假设我在 github.com/myprojects/myrepo 有一个 github 存储库

我们还假设我在 IntelliJ 中有一个项目,其中包含以下内容:

dependencies {
    // android
    compile 'com.android.support:appcompat-v7:21.0.0'
    // google play services
    compile 'com.google.android.gms:play-services:6.1.71'
}

我想通过 Gradle 添加我的 github 项目,所以我想依赖项需要添加如下内容:

compile 'github.com:myprojects:myrepo'

这显然不是它的工作方式,因为我得到“无法解析 com.github:myprojects:myrepo

有效的实际例子:

compile 'com.github.satyan:sugar:1.3'
compile 'com.github.castorflex.smoothprogressbar:library:x.x.x'

由于我不想将存储库克隆到 libs 文件夹中,如何在 build.gradle 文件的依赖项部分中添加编译命令以从 github 编译,以便我可以简单地添加如下内容:

compile 'com.github.myprojects:myrepo'

【问题讨论】:

    标签: android git github intellij-idea


    【解决方案1】:

    编译'com.github.castorflex.smoothprogressbar:library:x.x.x'

    因为这个库是在Central Maven 上发布的,所以它可以工作。

    编译'github.com:myprojects:myrepo'

    这显然不是它的工作方式,因为我得到“无法解决 >com.github:myprojects:myrepo

    在 github 上推送是不够的。 您必须在 Central Maven 或 JCenter 或本地 maven 上发布您的工件。您可以在 jcenter 上找到一些发布指南,例如 this

    【讨论】:

    • 谢谢。我个人无法让它工作(创建 bintray 帐户,设置存储库等),但我认为这就是它的完成方式,所以我将标记为已接受。不过,我可能最终能够弄清楚。干杯。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-11-25
    • 2020-09-03
    • 2013-10-21
    • 2019-12-08
    • 2023-04-02
    • 2021-05-13
    • 2022-01-09
    相关资源
    最近更新 更多