title: Gradle transitive repositories and credentials
body: <h2>The Situation</h2>
  
  <p>I have multiple Android plugins using JFrog Bintray. These are all located in a different <strong>maven</strong> Repository. All of there are private repositories and therefor need to be authenticated before resolving these dependencies. There is <strong>project A</strong> and <strong>project B</strong> which are being developed internally and also a <strong>project C</strong> which is developed by a third party, which needs to implement <strong>Project B</strong> as a dependency, which in turn has a dependency on <strong>project A</strong>. For <strong>project A</strong> there will be a <strong>bintray user 1</strong> which is granted authority to <strong>project A</strong>. There will also be a <strong>bintray user 2</strong> for the third party to authenticate them for <strong>project B</strong>.</p>
  
  <p>In <strong>project B</strong> there is a dependency on <strong>project A</strong> like so:</p>
  
  <pre><code>repositories {
      jcenter()
  
      maven {
          credentials {
              username = 'bintrayUser1'
              password = 'bintrayAPIKeyForUser1'
          }
          url  "https://url-to-projectA"
      }
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      testCompile 'junit:junit:4.12'
      compile 'com.project:A:1.0.0'
  }
  </code></pre>
  
  <p>Now there is another <strong>project C</strong> which has a dependency on <strong>Project B</strong> like so:</p>
  
  <pre><code>allprojects {
      repositories {
          jcenter()
          maven {
              url "https://link-to-projectB"
              credentials {
                  username = 'bintrayUser2'
                  password = 'bintrayAPIKeyForUser2'
              }
          }
      }
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      testCompile 'junit:junit:4.12'
      compile 'com.project:B:1.0.0'
  }
  </code></pre>
  
  <h2>The problem</h2>
  
  <p>The problem that occurs is that <strong>bintray user 2</strong> is asked to tell <strong>Project C</strong> where <strong>Project A</strong> is and needs to authenticate for it. I am wondering if it is possible that <strong>bintray user 2</strong> does not need to tell <strong>Project C</strong> where <strong>Project A</strong> is located and instead copy it over from <strong>Project B</strong>. </p>
  
  <p>The same goes for the authentication. Is there a way <strong>bintray user 2</strong> can copy over the authentication from <strong>bintray user 1</strong> for <strong>Project A</strong>?</p>
  
  <h2>The nonpreferred solution</h2>
  
  <p>Now what I could do is have <strong>project C</strong> also tell the location for each dependency in <strong>project B</strong>, but this doesn't scale well. This would be that each private dependency that I would put into <strong>project B</strong>, <strong>project C</strong> would need to locate and need authentication to. It would look something like this:</p>
  
  <pre><code>allprojects {
      repositories {
          jcenter()
          maven {
              url "https://link-to-projectA"
              credentials {
                  username = 'bintrayUser2'
                  password = 'bintrayAPIKeyForUser2'
              }
          }
          maven {
              url "https://link-to-projectB"
              credentials {
                  username = 'bintrayUser2'
                  password = 'bintrayAPIKeyForUser2'
              }
          }
          maven {
              url "https://link-to-projectX"
              credentials {
                  username = 'bintrayUser2'
                  password = 'bintrayAPIKeyForUser2'
              }
          }
          maven {
              url "https://link-to-projectX"
              credentials {
                  username = 'bintrayUser2'
                  password = 'bintrayAPIKeyForUser2'
              }
          }
          maven {
              url "https://link-to-projectX"
              credentials {
                  username = 'bintrayUser2'
                  password = 'bintrayAPIKeyForUser2'
              }
          }
      }
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      testCompile 'junit:junit:4.12'
      compile 'com.project:B:1.0.0'
  }
  </code></pre>
  
  <p>This would become hard to manage and something you might not want to give <strong>bintray user 2</strong> authority to.</p>
  
  <p>So again, is there a way to copy over the dependency locations and authorization?</p>