My project is in the archetypal Maven layout, and I am writing a task to run
only integration tests, which in my case are distinguished by the fact they all
end in "IT." I have devised the following to accomplish this:
task runIntegrationTests(dependsOn: [compile, compileTest]) << {
println "In task"
FileTree integrationTests = fileTree {
from "src/test"
include "**/*IT.class"
}
integrationTests.each {
test { it }
}
}
However, this isn't working. I have two questions: 1) How can I rewrite this
task to test all my integration tests only? And 2) How can I avoid hardcoding
the test source directory? Values I have tried like project.sourceSets["test"]
haven't worked.
Thanks.