title: Why doesn't Gradle include transitive dependencies in compile / runtime classpath?
body: <p>I'm learning how Gradle works, and I can't understand how it resolves a project transitive dependencies.</p>
  
  <p>For now, I have two projects :</p>
  
  <ul>
  <li>projectA : which has a couple of dependencies on external libraries</li>
  <li>projectB : which has only one dependency on projectA</li>
  </ul>
  
  <p>No matter how I try, when I build projectB, gradle doesn't include any projectA dependencies (X and Y) in projectB's compile or runtime classpath. I've only managed to make it work by including projectA's dependencies in projectB's build script, which, in my opinion does not make any sense. These dependencies should be automatically attached to projectB. I'm pretty sure I'm missing something but I can't figure out what.</p>
  
  <p>I've read about "lib dependencies", but it seems to apply only to local projects like described <a href="http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:project_jar_dependencies" rel="noreferrer">here</a>, not on external dependencies.</p>
  
  <p>Here is the build.gradle I use in the root project (the one that contains both projectA and projectB) : </p>
  
  <pre><code>buildscript {
      repositories {
          mavenCentral()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:0.3'
      }
  }
  
  subprojects {
      apply plugin: 'java'
      apply plugin: 'idea'
  
      group = 'com.company'
  
      repositories {
          mavenCentral()
          add(new org.apache.ivy.plugins.resolver.SshResolver()) {
              name = 'customRepo'
              addIvyPattern "ssh://.../repository/[organization]/[module]/[revision]/[module].xml"
              addArtifactPattern "ssh://.../[organization]/[module]/[revision]/[module](-[classifier]).[ext]"
          }
      }
  
      sourceSets {
          main {
              java {
                  srcDir 'src/'
              }
          }
      }
  
      idea.module { downloadSources = true }
  
      // task that create sources jar
      task sourceJar(type: Jar) {
          from sourceSets.main.java
          classifier 'sources'
      }
  
      // Publishing configuration
      uploadArchives {
          repositories {
              add project.repositories.customRepo
          }
      }
  
      artifacts {
          archives(sourceJar) {
              name "$name-sources"
              type 'source'
              builtBy sourceJar
          }
      }
  }
  </code></pre>
  
  <p>This one concerns projectA only :</p>
  
  <pre><code>version = '1.0'
  dependencies {
      compile 'com.company:X:1.0'
      compile 'com.company:B:1.0'
  }
  </code></pre>
  
  <p>And this is the one used by projectB :</p>
  
  <pre><code>version = '1.0'
  dependencies {
      compile ('com.company:projectA:1.0') {
          transitive = true
      }
  }
  </code></pre>
  
  <p>Thank you in advance for any help, and please, apologize me for my bad English.</p>