Some subprojects have the java plugin applied by their own build.gradle files. In the build.gradle of the root project, I want to apply plugin findbugs to each subproject that already has the java plugin. In build.gradle I have tried:
configure(subprojects.findAll {proj -> proj.getPluginManager().hasPlugin("java")}) {
apply(plugin: "findbugs")
}
and
subprojects {
if (getPluginManager().hasPlugin("java")) {
apply(plugin: "findbugs")
}
}
The outside loop does indeed run once for each subproject, but the inner closure never runs, in both case. I suspect this is because the subproject build scripts take effect before the outer one. Is there any way around this besides manually applying the findbugs plugin to each subproject?