# Basic query on gradle task syntax

**URL:** <https://discuss.gradle.org/t/basic-query-on-gradle-task-syntax/11277>\
**Category:** Help/Discuss\
**Created:** [August 21, 2015, 6:01am UTC](https://discuss.gradle.org/t/basic-query-on-gradle-task-syntax/11277 "2015-08-21T06:01:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vijay1](https://avatars.discourse-cdn.com/v4/letter/v/9f8e36/32.png) [@vijay1](https://discuss.gradle.org/u/vijay1)\
**Post date:** [August 21, 2015, 6:01am UTC](https://discuss.gradle.org/t/basic-query-on-gradle-task-syntax/11277/1 "2015-08-21T06:01:31Z")

</div>

Hi,

I am a Java developer and just joined a project which already uses Gradle. In build.gradle file, I have statements like below

springBoot {  
backupSource = false  
}

checkstyle {  
configProperties = [basedir: projectDir]  
}

task bowerInstall(type: Exec, dependsOn: npmInstall) {  
commandLine ‘node’, ‘node\_modules/bower/bin/bower’, ‘install’, ‘-F’, ‘-s’  
}

task gulpBuild(type: Exec, dependsOn: [npmInstall, bowerInstall]) {  
commandLine ‘node’, ‘node\_modules/gulp/bin/gulp’, ‘build’, ‘–release’, ‘–silent’  
}

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 ?

---

<div class="post-metadata">

**Author:** ![Francois\_Guillot](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/francois_guillot/32/8566_2.png) [@Francois\_Guillot](https://discuss.gradle.org/u/Francois_Guillot)\
**Post date:** [August 21, 2015, 6:24am UTC](https://discuss.gradle.org/t/basic-query-on-gradle-task-syntax/11277/2 "2015-08-21T06:24:12Z")

</div>

Well they can be anything.

Actually, when you see

> task XXX(YYY) {  
> /// ZZZ  
> }

you are calling the `task` method on the project instance that you build.gradle file delegates to.  
Its documentation can be found [here](https://docs.gradle.org/current/dsl/org.gradle.api.Project.html#org.gradle.api.Project:task%28java.util.Map,%20java.lang.String,%20groovy.lang.Closure%29)  
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](https://docs.gradle.org/current/dsl/org.gradle.api.plugins.quality.CheckstyleExtension.html), 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
}

```
