I'm looking to be able to create a task in my root project that executes all findbugs tasks for all of my subprojects. My root project has no source.
test_automation
--fixtures
--functional
--services
--utilities
I've got a task: task findbugs(dependsOn: ['findbugsMain', 'findbugsTest'])
I configure findbugsMain:
findbugsMain {
source subprojects.collect{project -> project.fileTree(project.sourceSets.main.output.classesDir)}
excludes = ['**/test_automation/build/**'] //root project's source
}
However when I execute, I get an error:
:findbugsMain (Thread[main,5,main]) started.
:findbugsMain
file or directory '/Users/ahumerickhouse/codebase/test_automation/build/classes/main', not found
Executing task ':findbugsMain' (up-to-date check took 0.249 secs) due to:
No history is available.
file or directory '/Users/ahumerickhouse/codebase/test_automation/build/classes/main', not found
:findbugsMain FAILED
:findbugsMain (Thread[main,5,main]) completed. Took 0.279 secs.
I can't figure out how to remove the root directory's source from the build. It's in there because it's configured prior to my additions. Any help would be appreciated, thanks.
EDIT I want the reports in the root directory for all of the subprojects, that's why I'm trying to do this. I was able to do this simply with CodeNarc:
codenarcMain {
source subprojects.collect {project -> project.sourceSets.main.groovy.srcDirs }
}
codenarcTest {
source subprojects.collect {project -> project.sourceSets.test.groovy.srcDirs }
}
task codenarc(type:CodeNarc, dependsOn:['codenarcMain', 'codenarcTest'])
$rootDir/build.gradle:
subprojects {
task findbugsAll {
dependsOn tasks.withType(FindBugs)
}
}
Execute with:
$ gradle findbugsAll
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