I’ve just upgraded to Gradle 9.2, and now a custom Test task that I have is not working. Previously I was using Gradle 8.14.3.
The custom Test task is defined as follows:
tasks {
...
register<Test>("integrationTest") {
group = "verification"
useJUnitPlatform()
shouldRunAfter(test)
filter {
excludeTestsMatching("*Test")
includeTestsMatching("*ITCase")
}
}
...
}
On Gradle 8.14.3, this task works perfectly. It compiles the code and runs all the integration tests, based on the test’s name. In Gradle 9.2, it doesn’t work at all. The task appears to have no dependencies, and when it runs, it just says “No Source”.
Example of running it through IntelliJ:
Task :integrationTest NO-SOURCE
BUILD SUCCESSFUL in 114ms
Consider enabling configuration cache to speed up this build: https://docs.gradle.org/9.2.0/userguide/configuration_cache_enabling.html
2:18:45 pm: Execution finished ‘integrationTest’.
I have no idea what’s changed between 8.14.3 and 9.2 that’s causing this, and I’m hoping some people more familiar with Gradle than me can tell me what’s changed and what I need to do to fix this.
I’m guessing there’s a different way of registering custom tasks, or something.