title: Building multi java project using Gradle
body: <p>I'm tearing my hair out over this. I've stripped my scripts right back to code provided in the Gradle tutorial pages as I think I'm either doing something fundamentally wrong or have misunderstood how a multi project application is supposed to be structured using gradle. </p>
  
  <p>I've got three java projects within eclipse, with all three containing a build.gradle script and only one containing a settings.gradle script. Structure is as follows:</p>
  
  <pre><code>Scripts
  -- build.gradle
  -- settings.gradle
  Database
  -- build.gradle
  Services
  -- build.gradle
  </code></pre>
  
  <p>I am attempting to build the 'Database' and 'Services' project using the build script in the 'Scripts' project. To create the project tree, I have the following code in settings.gradle:</p>
  
  <pre><code>include 'Services', 'Database'
  
  project (':Services').projectDir = new File(settingsDir, "../Services")
  project (':Database').projectDir = new File(settingsDir, "../Database")
  </code></pre>
  
  <p>Replicating the code in the multi-project tutorial (gradle docs), I'm trying to get each of the build scripts to print out some text, to ensure everything is set up correctly. My end goal is to have the dependencies correctly built when 'eclipseClasspath' is executed, so that all projects correctly compile within eclipse. However, the text is not being printed out as I expected!</p>
  
  <p>Below are what is contained within the three build scripts:</p>
  
  <p>Scripts build.gradle</p>
  
  <pre><code>allprojects {
      task hello &lt;&lt; { task -&gt; println "I'm $task.project.name" }
  }
  
  subprojects {
      hello &lt;&lt; {println "- I depend on Scripts"}
  }
  </code></pre>
  
  <p>Database build.gradle</p>
  
  <pre><code>hello.doLast { 
      println "- I'm inside database" 
  }
  </code></pre>
  
  <p>Services build.gradle</p>
  
  <pre><code>hello.doLast { 
      println "- I'm inside services" 
  }
  </code></pre>
  
  <p>Within the 'Scripts' project, when I run 'gradle -q hello', I get the following results:</p>
  
  <pre><code>I'm Scripts
  I'm AnprDatabase
  - I depend on Scripts
  I'm Database
  - I depend on Scripts
  </code></pre>
  
  <p>Why is the text '- I'm inside database' and '-I'm inside services' not appearing? I'm a bit baffled by it. I can only surmise it has something to do with my project structure. Can someone confirm this is the case? If not, what is the problem? As mentioned, I've stripped my scripts back to this simple example, as I could not get the dependencies to run within each projects build script using the same structure.</p>
  
  <p>Greatly appreciate any help offered.</p>