簡體   English   中英

'fork' git 存儲庫作為 gradle 中的依賴項

[英]'Fork' git repository as dependency in gradle

幾個小時前我做了一個話題,把我帶到了一個公共存儲庫: https://github.com/biezhi/webp-io

但是,我必須更新使用的庫 cwebp 並更改代碼。 這是我的第一個叉子。

我的叉子位於此處: https://github.com/KenobySky/webp-io

maven {url "https://jitpack.io"}
...
compile 'com.github.KenobySky:webp-io:master'

問題:我試圖將這個'fork' git 存儲庫聲明為 gradle 中的依賴項,但我在下面收到此錯誤,我該怎么辦?


Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
  > Could not find com.github.KenobySky:webp-io:master.
    Searched in the following locations:
      - https://repo.maven.apache.org/maven2/com/github/KenobySky/webp-io/master/webp-io-master.pom
    If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
    Required by:
        project :

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

參考

是否可以將 git 存儲庫聲明為 android gradle 中的依賴項?

• 確保在allprojects項目文件的build.gradle項目中添加maven { url 'https://jitpack.io' }

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = "1.3.72"
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.0.0"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        // Note: Add this here
        maven { url 'https://jitpack.io' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

• 現在在build.gradle應用程序中添加依賴項為

android {...}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    // ....
    implementation 'com.github.KenobySky:webp-io:master'
}

有用!

或者,您可以使用

implementation 'com.github.KenobySky:webp-io:0.06'

您的發布標簽和發布標簽標題中有錯字,標簽具有v0.06值但標題具有v0.0.6

在此處輸入圖像描述

您可以刪除此發布標記並使用v0.0.6或更高版本創建一個新標記,以使用0.0.6作為約定。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM