Here I understand “bowerInstall” and “gulpInstall” are custom taks as they have the keyword “task” in the beginning. But what about other statements like “springBoot” and “checkstlye”. It doesnt have the “task” prefix, but it looks like task. Are they called as tasks ? Can you please clarify my doubt ? Also do you think learning groovy syntax mandatory to write the build.gradle file ?
you are calling the task method on the project instance that you build.gradle file delegates to.
Its documentation can be found here
It’s a convenient way to create a new task on the given project.
The other code blocks are only one Groovy way to declare properties.
eg checkstyle corresponds to the project.checkstyle property.
This property happens to be of type CheckstyleExtension, but it could be anything.
Using a closure allows to further configure what’s inside the checkstyle property.
You could have written checkstyle.configProperties = [basedir: projectDir] with the same result.
The closure allows to configure several things from checkstyle at the same time.
Note that you can configure tasks as well like this.
A task, when created, is added to the project’s tasks container tasks
so the following works as well
tasks.bowerInstall {
//configure here stuffs from the task
}