Gradle - Apply configuration to all projects using the plugin

In a multi-project Gradle layout, how can I apply one bit of configuration to all projects using a specific plugin?

I want to see a little more results from my Java projects when tests run. I found this snippet that does what I want:

test {
    testLogging {
        events "passed", "skipped", "failed"
    }
}

Copying and pasting this into five of the six projects that use Java (one uses the Android plugin) seems inelegant. How can I put this once, but Gradle does not try and apply it to a project other than Java?

+4
source share
1 answer

. gradle .

subprojects build.gradle

subprojects {
    test {
        testLogging {
            events "passed", "skipped", "failed"
        }
    }
}
0

All Articles