I’ve added the checkstyle and findbugs plugins to a project. The problem for me is that their respective tasks are invoked automatically as part of the build process. Because they slow the build process down (especially findbugs), I would prefer to run them on demand.
it depends on what tasks are passed via commandline. if you call “gradle build”, this will trigger the check task that depends on the according findbugs/ checkstyle tasks. the straight forward way would be to trigger a different tasks (eg “assemble test”). you can also exclude tasks using the “-x” flag on the commandline.
I know that I could use the “-x” flag but doign “gradle build -x findbugsMain -x findbugsTest -x checkStyleMain -x checkStyleTest” every time is a bit unwieldy. What I would like to be able to do is to run “gradle build” and not have any of the findbugs or checkstyle tasks run. I would explicitly run the tasks (e. g. “gradle findbugsMain”) whenever I would want to analyze the code.
In effect, I’m looking for a way to remove the dependency on findbugs and checkstyle from the build task (or whichever task is relevant).
Removing dependencies is problematic. What you can try is programmatically adding excludes via ‘gradle.startParameter.excludedTaskNames’ in your build script.
The problem with this solution is that any task dependencies of the code quality tasks will still run. Conversely, ‘sourceSets = []’ will prevent the build/check tasks from depending on the code quality tasks, which is exactly what you asked for. (The tasks will still be available for manual execution.)
PS: I didn’t email the first proposal directly, I just edited the post once I found what I considered a better solution.