title: Adding an additional test suite to Gradle
body: <p>I am attempting to add Gradle (1.4) to an existing project that has multiple test suites. The standard unit test located in <code>src/test/java</code> ran successfully, but I am having trouble setting up a task to run the JUnit test located in <code>src/integration-test/java</code>. </p>
  
  <p>When I run <code>gradle intTest</code> I get several <code>cannot find symbol</code> errors for classes in <code>src/main</code>. This leads me to believe that the dependencies are not set up correctly. How do I setup <code>intTest</code> so that it will run my JUnit integration tests?</p>
  
  <p><strong>build.gradle</strong></p>
  
  <pre><code>apply plugin: 'java'
  
  sourceCompatibility = JavaVersion.VERSION_1_6
  
  sourceSets {
      integration {
          java {
              srcDir 'src/integration-test/java'
          }
          resources {
              srcDir 'src/integration-test/resources'
          }
      }
  }
  
  dependencies {
      compile(group: 'org.springframework', name: 'spring', version: '3.0.7')
  
      testCompile(group: 'junit', name: 'junit', version: '4.+')
      testCompile(group: 'org.hamcrest', name: 'hamcrest-all', version: '1.+')
      testCompile(group: 'org.mockito', name: 'mockito-all', version: '1.+')
      testCompile(group: 'org.springframework', name: 'spring-test', version: '3.0.7.RELEASE')
  
      integrationCompile(group: 'junit', name: 'junit', version: '4.+')
      integrationCompile(group: 'org.hamcrest', name: 'hamcrest-all', version: '1.+')
      integrationCompile(group: 'org.mockito', name: 'mockito-all', version: '1.+')
      integrationCompile(group: 'org.springframework', name: 'spring-test', version: '3.0.7.RELEASE')
  }
  
  
  task intTest(type: Test) {
      testClassesDir = sourceSets.integration.output.classesDir
      classpath += sourceSets.integration.runtimeClasspath
  }
  </code></pre>
  
  <p><strong><em>Details:</strong> Gradle 1.4</em></p>
  
  <p><strong><em>Solution:</strong> I had not set the compile classpath for the integration test source set (see below). In my I code I set the compile class path to <code>sourceSets.test.runtimeClasspath</code> so that I don't have the duplicate dependencies for "integrationCompile"</em></p>
  
  <pre><code>sourceSets {
      integrationTest {
          java {
              srcDir 'src/integration-test/java'
          }
          resources {
              srcDir 'src/integration-test/resources'
          }
          compileClasspath += sourceSets.main.runtimeClasspath
      }
  }
  </code></pre>