在我的應用程式中,我宣告了這個 repo:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven {
url = uri("https://jitpack.io")
}
maven { // <- This is my private repo
credentials {
username = extra["mavenUser"] as String
password = extra["mavenPassword"] as String
}
url = uri(extra["mavenUrl"] as String)
}
}
}
它下載 aar 沒有任何問題,但不下載源代碼,當我試圖通過單擊?下載源代碼?來強制它時,它會失敗:
Execution failed for task ':app:DownloadSources'.
> Could not resolve all files for configuration ':app:downloadSources_36c7b334-04c2-4099-b66c-2adc137cc95c'.
> Could not find com.example.path:common-core:0.0.1@aar.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/example/path/common-core/0.0.1@aar/common-core-0.0.1@aar.pom
- https://repo.maven.apache.org/maven2/com/example/path/common-core/0.0.1@aar/common-core-0.0.1@aar.pom
- https://jitpack.io/com/example/path/common-core/0.0.1@aar/common-core-0.0.1@aar.pom
- https://repo.replaced-domain.com/mvn/replaced/replaced/com/example/path/common-core/0.0.1@aar/common-core-0.0.1@aar.pom <-- This is my private repo
Required by:
project :app
UPD 1:如果我單擊?選擇源?并指定我的本地源 jar,它什么也不做。
如何解決?
uj5u.com熱心網友回復:
我也有自己的庫,我建議在您的工件中添加一個分類器,專門下載源代碼和 Javadoc。盡管可能沒有必要,但它可能對您的情況有所幫助 - 最后兩個工件專門帶來了源代碼和 Javadoc:
<dependency>
<groupId>com.github.michaelgantman</groupId>
<artifactId>MgntUtils</artifactId>
<version>1.6.0.1</version>
</dependency>
<dependency>
<groupId>com.github.michaelgantman</groupId>
<artifactId>MgntUtils</artifactId>
<version>1.6.0.1</version>
<classifier>javadoc</classifier>
</dependency>
<dependency>
<groupId>com.github.michaelgantman</groupId>
<artifactId>MgntUtils</artifactId>
<version>1.6.0.1</version>
<classifier>sources</classifier>
</dependency>
uj5u.com熱心網友回復:
我目前沒有使用 Android Studio 進行開發,但是在查看您的輸出時:
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/example/path/common-core/0.0.1@aar/common-core-0.0.1@aar.pom
- https://repo.maven.apache.org/maven2/com/example/path/common-core/0.0.1@aar/common-core-0.0.1@aar.pom
- https://jitpack.io/com/example/path/common-core/0.0.1@aar/common-core-0.0.1@aar.pom
- https://repo.replaced-domain.com/mvn/replaced/replaced/com/example/path/common-core/0.0.1@aar/common-core-0.0.1@aar.pom <-- This is my private repo
似乎ext(擴展)部分沒有正確解決/計算。
ext當您在依賴項中顯式設定時可能就足夠了:
build.gradle.kts -> dependencies -> {
api(group="com.example.path", name="common-core", version="0.0.1", ext="aar")
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/415954.html
標籤:
