从命令行可以正常工作,但IntelliJ会将integrationTest源显示为源,而不是测试源。
Gradle代码:
sourceSets {
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/it/java')
output.classesDir = "$buildDir/classes/it"
}
def resourceDir = file('src/it/resources')
if (resourceDir.exists()) {
resources.srcDir resourceDir
output.resourcesDir = "$buildDir/resources/it"
}
}
}