title: Build error with gradle Could not find method testCompile()
body: <p>I'm new to gradle and I'm getting a build error that I don't really understand. My project is just an empty shell with the directory structure and no java source code. Here is my root build.gradle file</p>
  <pre><code>allprojects {
      //Put instructions for all projects
      task hello &lt;&lt; { task -&gt; println &quot;I'm $task.project.name&quot; }
  }
  
  subprojects {
      //Put instructions for each sub project
      apply plugin: &quot;java&quot;
      repositories {
          mavenCentral()
      }
  }
  
  dependencies {
      testCompile group: 'junit', name: 'junit', version: '4.+'
  }
  </code></pre>
  <p>when I execute the gradle build command the build fails because it doesn't know the testCompile method with this message:</p>
  <blockquote>
  <p>Could not find method testCompile() for arguments [{group=junit, name=junit, version=4.+}] on root project</p>
  </blockquote>
  <p>I use Gradle 2.5.</p>
  <p>I've understood that this method is a part of the java plugin which I've loaded. I don't see what went wrong, can you help?</p>