title: Unable to load Maven meta-data from private repo. Received 403: Forbidden
body: <p>I'm trying append a private dependency into my project (react-native-android) via Maven. Unfortunately I'm get following error message when I try to build <code>./gradlew assembleDebug</code> my project.</p>
  
  <p><br />
  <strong>Error message returned as below:</strong></p>
  
  <pre><code>&gt; FAILURE: Build failed with an exception.
  
  * What went wrong:
  Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
  &gt; Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
     &gt; Could not resolve com.facebook.react:react-native:0.19.+.
       Required by:
           project :app &gt; project :react-native-i18n
        &gt; Failed to list versions for com.facebook.react:react-native.
           &gt; Unable to load Maven meta-data from https://xxxPRIVATE_REPOxxx/android/com/facebook/react/react-native/maven-metadata.xml.
              &gt; Could not get resource 'https://xxxPRIVATE_REPOxxx/android/com/facebook/react/react-native/maven-metadata.xml'.
                 &gt; Could not GET 'https://xxxPRIVATE_REPOxxx/android/com/facebook/react/react-native/maven-metadata.xml'. Received status code 403 from server: Forbidden
  </code></pre>
  
  <p><strong>Code example</strong></p>
  
  <pre><code>repositories {
      mavenCentral()
      maven {
          url 'https://maven.google.com/'
          name 'Google'
      }
      maven { url "https://xxxPRIVATE_REPOxxx/android" }
  }
  
  dependencies {
      implementation project(':react-native-i18n')
      implementation 'com.android.support:support-v4:+'
      implementation 'xxxPRIVATE_DEPENDENCYxxx:1.0.+'
  }
  </code></pre>
  
  <p>I have read numerous post and research on maven and gradle's topic. Here's my finding towards my issues:</p>
  
  <ol>
  <li>Meaning that my <a href="https://docs.gradle.org/current/userguide/declaring_repositories.html" rel="nofollow noreferrer">sequence of declaring maven</a> by right will get the "correct/suitable" module from the first declared maven instead of the following (maven xxxPRIVATE_REPOxxx)
  
  <blockquote>
    <p>The order of declaration determines how Gradle will check for dependencies at runtime. If Gradle finds a module descriptor in a particular repository, it will attempt to download all of the artifacts for that module from the same repository. You can learn more about the inner workings of dependency downloads.</p>
  </blockquote></li>
  <li>Returning of 403 Forbidden does not necessary mean I do not have access to the repo I'm trying to access, but also <a href="https://github.com/gradle/gradle/issues/5606" rel="nofollow noreferrer">missing of resource</a>.</li>
  </ol>
  
  <p>Hence I made an assumption here... During the download of project dependencies, Maven loop through both maven repo (maven google &amp; xxxPRIVATE_REPOxxx) to get the suitable lib. However when it reaches xxxPRIVATE_REPOxxx, it failed to locate maven-metadata.xml therefore result with  <em><a href="https://xxxPRIVATE_REPOxxx/android/com/facebook/react/react-native/maven-metadata.xml" rel="nofollow noreferrer">https://xxxPRIVATE_REPOxxx/android/com/facebook/react/react-native/maven-metadata.xml</a></em> and 403 Forbidden.</p>
  
  <p><strong>My question:</strong> </p>
  
  <p>Should there be a way to indicate which dependency to get from which Maven?</p>
  
  <p>I was imaging something like this
  <code>implementation 'xxxPRIVATE_DEPENDENCYxxx:1.0.+' : xxxPRIVATE_REPOxxx</code> (You know what I mean)</p>
  
  <p><strong>I have tried:</strong></p>
  
  <ol>
  <li>Upgrading my Android-Plugin to 3.5.0</li>
  <li>Upgrading my Gradle version to 5.6.4</li>
  <li>./gradlew clean and re-build after steps 1 and 2</li>
  </ol>