The problem is the following. The result of a Groovy closure (neglecting an explicit return
statement) is the last line of the closure.
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
configurations.testCompile.collect { it.isDirectory() ? it : zipTree(it) }
sourceSets.test.output
}
So the code above will result in including only the compile test classes. You’ll want to do this.
from { configurations.testRuntime.collect { it.isDirectory() ? it : zipTree(it) }
from sourceSets.test.output
Couple of other things you might notice:
- No need to include both
compile
andtestCompile
sincetestCompile
extendscompile
. That is, allcompile
dependencies are also automatically on the test compilation classpath. - Really, you should be using
testRuntime
as you’ll need any and all runtime dependencies to actually execute the tests.