本文介绍了使用Jitpack将Github包构建为Maven的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能指导我如何使用构建github项目。

can someone please guide me on how to build github projects using Jitpack.

我试图遵循这个指示,并总是得到一个错误。我分叉了一个项目并在其上添加了一些更改,因此我需要将当前提交ID作为版本。

I tried to follow this instruction and always got an error. I forked a project and added some changes on it so I need to get the current commit id as version.

Step 1. Add the JitPack maven repository to your build file

    url "https://jitpack.io"

Step 2. Add the dependency in the form:

    Group: com.github.Username
    Artifact: Repository Name
    Version: Release tag or commit id

That's it! The first time you request a project JitPack checks out the code, builds it and sends the Jar files back to you.


这是我的gradle文件

Here is my gradle file

buildscript {
    repositories {
        mavenCentral()
        maven { url 'http://download.crashlytics.com/maven' }
        maven { url "https://jitpack.io" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
        classpath 'com.jakewharton.hugo:hugo-plugin:1.1.+'
        classpath 'com.stanfy.spoon:spoon-gradle-plugin:0.10.+'
        classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
    }
}


dependencies {
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.android.support:recyclerview-v7:22.0.0'

    //THIS ONE SEEMS NOT TO WORK BASE ON THE INSTRUCTION
    compile ('com.github.username:repo:commitId')
}

推荐答案

JitPack存储库不应低于 buildscripts 在这种情况下。它应该在仓库之下:

The JitPack repository shouldn't be under buildscripts in this case. It should be just under repositories:

buildscript {
 // same as you have but without jitpack.io
}

repositories {
    jcenter()
    maven { url "https://jitpack.io" }
}

dependencies {
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.android.support:recyclerview-v7:22.0.0'

    compile 'com.github.mightymilk:material-dialogs:v0.7.2.4'
    // or if you just want the 'aar':
    //compile 'com.github.mightymilk:material-dialogs:v0.7.2.4@aar'
}

构建插件的存储库在 buildscripts 下,但正常的依赖库只放在存储库下

Repositories for build plugins are placed under buildscripts but normal dependency repositories are just placed under repositories {.

这篇关于使用Jitpack将Github包构建为Maven的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 16:06