title: Integration test on Gradle 4.0-milestone2
body: <p>I am migrating a Java library to Gradle <code>4.0-milestone2</code> and I encountered some issues with the integration task defined below.</p>
  
  <p>This task allows me to have two different source directories <code>src/test</code> and <code>src/integration</code> and have separate gradle tasks to run them, <code>./gradlew test</code> and <code>./gradlew integration</code>.</p>
  
  <p>Contents of <code>integration.gradle</code></p>
  
  <pre><code>sourceSets {
    integration {
      java {
        compileClasspath += main.output + test.output
        runtimeClasspath += main.output + test.output
        srcDir file('src/integration/java')
      }
      resources.srcDir file('src/integration/resources')
    }
  }
  configurations {
    integrationCompile.extendsFrom testCompile
    integrationRuntime.extendsFrom testRuntime
  }
  idea {
    module {
      testSourceDirs += file('src/integration/java')
      scopes.TEST.plus += [configurations.integrationCompile]
    }
  }
  task integration(type: Test) {
    testClassesDir = sourceSets.integration.output.classesDir
    classpath = sourceSets.integration.runtimeClasspath
  }
  
  integration.mustRunAfter test
  </code></pre>
  
  <p>Contents of <code>build.gradle</code> </p>
  
  <pre><code>apply plugin: 'java-library'
  apply plugin: 'idea'
  
  apply from: './integration.gradle'
  
  targetCompatibility = '1.7'
  sourceCompatibility = '1.7'
  
  dependencies {
  
    api 'com.github.ihsanbal:LoggingInterceptor:2.0.0'
    api 'com.squareup.okhttp3:okhttp-urlconnection:3.2.0'
    api 'com.squareup.retrofit2:retrofit:2.0.2'
    api 'com.squareup.retrofit2:converter-gson:2.0.2'
    api 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
  
    testImplementation 'junit:junit:4.12'
  }
  
  test {
    testLogging.showStandardStreams = true
  }
  
  
  task copyTestResources(type: Copy) {
    from sourceSets.test.resources
    into sourceSets.test.output.classesDir
  }
  processTestResources.dependsOn copyTestResources
  </code></pre>
  
  <p>There are two problems with this configuration.</p>
  
  <p>1) <code>copyTestResources</code> task does not work as <code>classesDir</code> is deprecated and <code>classesDirs</code> is not compatible.</p>
  
  <p>2) The classpaths are not including the library dependencies. 
  Compilation fails full of the following errors</p>
  
  <pre><code>error: cannot find symbol
  error: package SOMETHING does not exist
  </code></pre>
  
  <p>Any clues on how to solve this issues? Thank you</p>