Reputation: 10739
I'm trying to run a Gradle build for an existing Java project, but I get the following error that appears to be unrelated to my project.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':myProject:test'.
> Could not get unknown property 'testSrcDirs' for task ':myProject:test' of type org.gradle.api.tasks.testing.Test.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
How can I fix this error?
Upvotes: 0
Views: 574
Reputation: 49
If you land on this page searching for the testSrcDir exception, try updating the gradle clover plugin jar from 2.0.1 to latest versions.
If can't update the version you could also try the workaround suggested here
test {
ext.testSrcDirs = project.sourceSets.test.java.srcDirs
}
Upvotes: 1
Reputation: 10739
For me, the issue was that my project needed to be built with Gradle 2.x but I was using Gradle 3.x. Once I reverted my Gradle version, the build worked.
Upvotes: 0