What does 'type' do in a Task?

Hi there,

I read that we can define “tasks” in many ways. One way stated from here http://gradle.org/docs/current/dsl/org.gradle.api.Task.html is like this:

task myTask(type: SomeType) { configure closure }

But I don’t see an explanation on what does the “type” key and “SomeType” value will do to the task. It appears to have an affect of a task inherit properties from the SomeType. Can someone explain how this works and its usage?

Thanks, Zemian

The type determines 1. what the task does 2. how it can be configured (i.e. which properties and methods it has besides those shared among all tasks). If the type isn’t specified, it defaults to ‘DefaultTask’. Technically, the type is the Java type of the object that represents the task.