7

I recently started seeing a build error in our CircleCI build:

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

Re-running the job sometimes allows the build to complete, even though when I locally attempt to load that URL (https://jitpack.io/com/github/gundy/semver4j/0.16.4/semver4j-0.16.4-nodeps.jar), I get an error: "Not found in JitPack repository".

I tried running the build locally with the --refresh-dependencies gradle option, and I was able to reproduce the error... but only once. With no changes to my build.gradle file, the build succeeded the next time I tried it.

I found that the Kotlin gradle plugin's dependency on semver4j was modified in this commit, making it an embedded dependency. I was hopeful that upgrading the Kotlin gradle plugin to 1.7.0 would pick up this change, but I'm not sure that it did; it certainly didn't fix my CircleCI build issues.

I did confirm that jitpack is included in the repositories section of our build.gradle file:

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

I'm hoping someone else has a fix for this, or some gradle magic that can serve as a workaround?

Mark McClelland
  • 4,980
  • 4
  • 35
  • 48

2 Answers2

19

In buildscript:

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

In allprojects, add it but over the jitpack one:

maven { url 'https://mvnrepository.com/artifact/com.github.gundy/semver4j'}
maven { url 'https://jitpack.io' }
luismiguelss
  • 155
  • 2
  • 16
Hechtsuppe
  • 206
  • 2
  • 2
    This makes sense. Having a URL to the mvnrepository.com repo was the key. So far, this change is working well for me, as expected. And I noticed this is one of your first contributions to Stack Overflow... thanks! – Mark McClelland Sep 09 '22 at 20:59
2

Looks like some Jitpack's services are suffering an outage, check it out on https://status.jitpack.io/

Giorgio Fellipe
  • 304
  • 1
  • 2
  • 10
  • Good to know — thanks for the link! I've tweeted asking if they have any news on what's going on. It would be nice if this were more reliable. – Mark McClelland Sep 09 '22 at 21:40