title: How to substitute a locally unavailable repository in Gradle?
body: <p>For a project I need to get a JAR from a repository that is only available on customers network. As this isn't available on public repositories and I locally don't have access to the customers network, I want to substitute this repository locally.</p>
  <p>I copied the jar into a local repository and declared it with:</p>
  <pre><code>maven {
      url = uri(&quot;${project.getRootDir()}/local_repo&quot;)
  }
  </code></pre>
  <p>That works fine, however I want to keep the build files and logic the same regardless if I run it locally or on the customers system.</p>
  <p>According to <a href="https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:declaring_multiple_repositories" rel="nofollow noreferrer">Gradle Docs</a> repositories get called in the order they are declared.
  So according to this logic I first declare MavenCentral, then the customers repository (that is unavailable locally) and then my own local substitute repository:</p>
  <pre><code>mavenCentral()
  maven {
      url = uri(&lt;costumer_repo&gt;)
  }
  maven {
      url = uri(&quot;${project.getRootDir()}/local_repo&quot;)
  }
  </code></pre>
  <p>But it seems now gradle stops when it can't reach the unavailable repo and therefore doesn't find the JAR in the local repo.
  If I turn around the local and the unavailable repo, it works again, but this way it always uses the local repo even on the customer system according to the gradle docs.</p>
  <p>Is there a way to tell gradle to keep looking at the other repos even if one is unavailable, or is there a different way to substitute an unavailable repo?</p>