In a multi-project Gradle build, how can I apply one bit of config to all projects that use a certain plug-in?
I want to see a bit more output from my java-based projects when tests are being run. I've found this snippet, which does what I want:
test {
testLogging {
events "passed", "skipped", "failed"
}
}
Copy and pasting this into the five out of six projects that use Java (one uses the Android plugin) seems inelegant. How can I put this in once, but have Gradle not try and apply it to the non-Java project?
See the organising build logic section in the gradle documentation for various options for code re-use.
I'd probably use a subprojects
closure in the root build.gradle
subprojects {
test {
testLogging {
events "passed", "skipped", "failed"
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With