Gradle 构建错误:找不到 semver4j-0.16.4-nodeps.jar

问题描述 投票:0回答:3

我最近开始在我们的 CircleCI 构建中看到构建错误:

A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find semver4j-0.16.4-nodeps.jar (com.github.gundy:semver4j:0.16.4).
     Searched in the following locations:
         https://jitpack.io/com/github/gundy/semver4j/0.16.4/semver4j-0.16.4-nodeps.jar

重新运行作业有时会允许构建完成,即使当我在本地尝试加载该 URL 时(https://jitpack.io/com/github/gundy/semver4j/0.16.4/semver4j-0.16.4 -nodeps.jar),我收到错误:“在 JitPack 存储库中找不到”。

我尝试使用

--refresh-dependencies
gradle 选项在本地运行构建,并且我能够重现该错误......但只能重现一次。在没有更改我的 build.gradle 文件的情况下,下次尝试时构建成功了。

我发现 Kotlin gradle 插件对 semver4j 的依赖在 this commit 中被修改,使其成为 embedded dependency。我希望将 Kotlin gradle 插件升级到 1.7.0 能够接受此更改,但我不确定是否确实如此;它当然没有解决我的 CircleCI 构建问题。

我确实确认 jitpack 包含在我们的 build.gradle 文件的存储库部分中:

maven { url "https://jitpack.io" }

我希望其他人能解决这个问题,或者有一些 gradle 魔法可以作为解决方法?

android kotlin gradle
3个回答
20
投票

buildscript

buildscript {
   repositories {
      //maven { url 'https://jitpack.io' } // Delete
      // Add:
      maven { url 'https://mvnrepository.com/artifact/com.github.gundy/semver4j' }
   }
}

allprojects
中,将其添加到 jitpack 之上:

maven { url 'https://mvnrepository.com/artifact/com.github.gundy/semver4j'}
maven { url 'https://jitpack.io' }

2
投票

看起来有些 Jitpack 的服务出现了中断,请在 https://status.jitpack.io/

上查看

0
投票

用于:学习/firebase-android-sdk/buildSrc/build.gradle.kts

repositories {
    maven(url = "https://mvnrepository.com/artifact/com.github.gundy/semver4j")
    mavenCentral()
    mavenLocal()
    maven(url = "https://maven.google.com/")
    maven(url = "https://storage.googleapis.com/android-ci/mvn/")
    maven(url = "https://plugins.gradle.org/m2/")
}

要点: 添加

mavenCentral()
可以,如果不行,添加 也
https://mvnrepository.com/artifact/com.github.gundy/semver4j

© www.soinside.com 2019 - 2024. All rights reserved.