title: Gradle multiproject gives "Could not find property 'sourceSets' on project" error
body: <p>I had quite good gradle configuration, that built everything just fine. But one of the projects of my multi-project build derived from the rest of them so much, that I would gladly move it to another git repo and configure submodules to handle it.</p>
  
  <p>First, I moved Project and its resources to subfolder <code>Libraries/MovedProject</code>. After altering some lines in gradle configurations it worked fine. But then I decided to write a new build.gradle just for this project, and move all configurations there from the main one.</p>
  
  <p>And this is where everything stopped working. When I try to call any task it always ends
  with <code>Could not find property 'sourceSets' on project ':Libraries/MovedProject'</code>. Line which is responsible for it is:</p>
  
  <pre><code>dependencies {
      ...
      if (noEclipseTask) {
          testCompile project(':Libraries/MovedLibrary').sourceSets.test.output
      }
  }
  </code></pre>
  
  <p>which I use for running tests in which I use classes from other projects. If I remove that line, the build fails only when it reaches compileTestJava task of projects that make use of MovedProject. If I remove that line and call <code>gradle :Libraries/MovedLibrary:properties</code> I can see :</p>
  
  <pre><code>...
  sourceCompatibility: 1.7
  sourceSets: [source set main, source set test]
  standardOutputCapture: org.gradle.logging.internal.DefaultLoggingManager@1e263938
  ...  
  </code></pre>
  
  <p>while <code>gradle :Libraries/MovedLibrary:build</code> builds correctly.</p>
  
  <p>Currently I've got everything set up as following:</p>
  
  <ol>
  <li><p>directories:</p>
  
  <ul>
  <li>/SomeMainProject1</li>
  <li>/SomeMainProject2</li>
  <li>/SomeMainProject3</li>
  <li>/Libraries
  <ul>
  <li>/MovedProject
  <ul>
  <li>build.gradle</li>
  <li>dependencies.gradle</li>
  <li>project.gradle</li>
  <li>tasks.gradle</li>
  </ul></li>
  </ul></li>
  <li>/Builder
  <ul>
  <li>dependencies.gradle</li>
  <li>project.gradle</li>
  <li>tasks.gradle</li>
  </ul></li>
  <li>build.gradle</li>
  <li>settings.gradle</li>
  </ul></li>
  <li><p>settings.gradle</p>
  
  <pre><code>include Libraries/MovedProject,
          SomeMainProject1,
          SomeMainProject2,
          SomeMainProject3
  </code></pre></li>
  <li><p>sourceSets for MovedProject are defined in <code>Libraries/MovedProject/project.gradle</code>:</p>
  
  <pre><code>sourceSets {
      main {
          java {
              srcDir 'src'
              srcDir 'resources'
          }
          resources { srcDir 'resources' }
      }
      test { java {
          srcDir 'test/unit'
      } }
  }
  </code></pre></li>
  <li><p>dependencies that makes use of sourceSets.test.output are stored in <code>Builder/dependancies.gradle</code>, and set for each project that needs MovedProject to run tests:</p>
  
  <pre><code>project(':SomeMainProject1') {
      dependencies {
          ...
  
          if (noEclipseTask) {
              testCompile project(':Libraries/net.jsdpu').sourceSets.test.output
          }
      }
  }
  </code></pre></li>
  </ol>
  
  <p>What would be the easiest way to get rid of that error and make gradle build projects with current directory structure? I would like to understand why gradle cannot see that property.</p>