Make jacoco test coverage verification fail if there is no test

The jacoco plugin provides a task jacocoTestCoverageVerification which fails the build if the coverage is below some configured threshold. However, the plugin only runs if some *.exec file exists, which is created during test execution. If the subproject doesn’t have any test, this file is not created, causing the verification task to be skipped. This is implemented using a file check with onlyIf:

I’d like to think that having no test is a special case of having 0% code coverage, and I’d like to fail my build if that is the case. How can I override the onlyIf in the plugin task definition? Is this a bug worth fixing in Gradle’s code?

Thank you,
Carsten

Any help is appreciated: Bug: build should fail if subproject does not have any test · Issue #82 · C-Otto/BitBook · GitHub