Gradle Integration and Custom Source Sets

I'm using IntelliJ 13 and have a Gradle project with some custom source set mappings:

sourceSets {
    integrationTest {
        compileClasspath = sourceSets.main.output + configurations.testRuntime
        runtimeClasspath = output + sourceSets.main.output + configurations.testRuntime
        groovy {
            srcDir = 'src/testIntegration/groovy'
        }
        resources {
            srcDir 'src/testIntegration/resources'
        }
    }
}

task testIntegration(type: Test) {
    testClassesDir = sourceSets.integrationTest.output.classesDir
    classpath = sourceSets.integrationTest.runtimeClasspath
}


Every time I click the refresh in the Gradle window, the folder src/testIntegration/groovy becomes unmarked as a 'Test Sources Root'.

How do I convince IntelliJ's Gradle integration that the src/testIntegration/groovy folder contains test source code?

2 comments
Comment actions Permalink

Hi, Matt

add the following to your build script:

apply plugin: 'idea' idea{     module {         testSourceDirs += file('src/testIntegration/groovy')     } }

0
Comment actions Permalink

That worked great; thanks.

0

Please sign in to leave a comment.