title: Gradle custom test sourceSet
body: <p>I have a gradle project and have <strong>main</strong> and <strong>test</strong> as sourceSets.</p>
  
  <p>I do want test-main not to be part of test source sets. Now the issue I encounter is that when projects are build, the <strong>test-main</strong> is marked as <strong>Sources Root</strong> instead of <strong>Test Sources Root</strong>.</p>
  
  <p>This leads to compilation errors and I have to manually mark <strong>test-mains</strong> as Source Test Root for all subprojects.</p>
  
  <p>I created a task in order to enforce intellij to mark them as Sources Test Root but seems like I am doing something wrong.</p>
  
  <p>hints:</p>
  
  <ul>
  <li>Intellij IDEA 2016.2</li>
  <li>Gradle 2.14</li>
  </ul>
  
  <p>Thanks,</p>
  
  <pre><code>subprojects {
    apply plugin: 'java' // all our projects are Java projects
  
    sourceCompatibility = '1.8'
    targetCompatibility = '1.8'
  
    tasks.withType(JavaCompile) {
      options.encoding = 'UTF-8'
      options.warnings = false // There are too many :-(
    }
  
    configurations {
      testMainsCompile.extendsFrom testCompile
      testMainsRuntime.extendsFrom testMainsCompile
    }
  
    sourceSets {
      main {
        java {
          srcDirs = ['src']
        }
        resources {
          srcDirs = ['src']
        }
      }
      test {
        java {
          srcDirs = ['test']
        }
        resources {
          srcDirs = ['test']
        }
      }
      testMains {
        java {
          srcDirs = ['test-mains']
          compileClasspath = test.output + main.output + configurations.testMainsCompile
          runtimeClasspath = output + compileClasspath + configurations.testMainsRuntime
        }
        resources {
          srcDirs = ['test-mains']
        }
      }
    }
  
    // dummy task just to convince intellij idea that testMains is a test class folder
    task testMainsTest(type: Test) {
      testClassesDir = sourceSets.testMains.output.classesDir
      classpath += sourceSets.testMains.runtimeClasspath
    }
  
  [...]
  
  }
  </code></pre>