How do we switch away from jcenter to a private repo

jcenter is down again. This time due to an expired SSL certificate. Is there a way of swapping the repository EAS uses with our own repo or at least swap it to maven central?

Hi @trajano

What library/libraries is it trying to download from JCenter? You might be able to upgrade them or else you might need a config plugin to put other repositories before jcenter():

 repositories {
    ...
    google()
    mavenCentral()
    gradlePluginPortal() 
    jcenter()
    ...
 }

See also: android - Is JCenter down permanently (31 Oct)? - Stack Overflow

I think it’s react-native-pager-view so we probably just need to update that one component

[RUN_GRADLEW]       > Could not resolve org.jdom:jdom2:2.0.6.
[RUN_GRADLEW]         Required by:
[RUN_GRADLEW]             project :react-native-pager-view > com.android.tools.build:gradle:4.2.1 > com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta09
[RUN_GRADLEW]          > Could not resolve org.jdom:jdom2:2.0.6.
[RUN_GRADLEW]             > Could not get resource 'https://jcenter.bintray.com/org/jdom/jdom2/2.0.6/jdom2-2.0.6.pom'.
[RUN_GRADLEW]                > Could not HEAD 'https://jcenter.bintray.com/org/jdom/jdom2/2.0.6/jdom2-2.0.6.pom'.
[RUN_GRADLEW]                   > The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.3.3/userguide/build_environment.html#gradle_system_properties
[RUN_GRADLEW]                      > PKIX path validation failed: java.security.cert.CertPathValidatorException: validity check failed

It seems to be version locked to an older version in Expo 45 though.

However, I would rather use my own repo Declaring repositories is there a way to do it globally?

I think you should be able to insert the relevant stuff from that link into the right place in build.gradle using a config plugin.

Off hand I don’t know if there’s another way to do it. (I don’t know much about gradle.)

In AzureDevOps but the concept is portable across

      - bash: |
          mkdir $HOME/.gradle
          cat <<EOT > $HOME/.gradle/init.gradle
          allprojects {
            repositories {
              mavenLocal()
              mavenCentral()
            }
          }
          EOT
        displayName: Set maven repo

The above works but to really solve my issue to use a private repo that we’d have full control over.

      - bash: |
          mkdir $HOME/.gradle
          cat <<EOT > $HOME/.gradle/init.gradle
          allprojects {
            repositories {
              mavenLocal()
              maven {
                url "https://myrepo"
                username "..."
                password "..."
              }    
            }
          }
          EOT
        displayName: Set maven repo
1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.