Using the Checkstyle plugin
If we are working on a Java project, and apply the Java plugin to our project, we get an empty task with the name check
. This is a dependency task for the build
task. This means that when we execute the build
task, the check
task is executed as well. We can write our own tasks to check something in our project and make it a dependency task for the check
task. So if the check
task is executed, our own task is executed as well. And not only the tasks we write ourselves, but the plugins also, can add new dependency tasks to the check
task.
We will see in this chapter that most plugins will add one or more tasks as a dependency task to the check
task. This means that we can apply a plugin to our project, and when we invoke the check
or build
task, the extra tasks of the plugin are executed automatically.
Also, the check
task is dependent on the test
task. Gradle will always make sure the test
task is executed before the check
task, so we know that all source files and...