O'Reilly logo

Gradle Essentials by Abhinandan, Kunal Dabir

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Tasks

As we have seen so far, a task is a named action that performs some build logic. It's a unit of build work. For example, clean, compile, dist, and so on, are typical build tasks that easily come to our mind if we have to write tasks for our project. Tasks are more or less analogous to Ant's targets.

The simplest way to create a task is as follows:

task someTask

Before we go any further with tasks, let's take a moment to ponder about task creation.

We used the taskName task form of a statement.

If we rewrite it as a task (taskName), it will immediately look like the method call.

The preceding method, as we might have already guessed by now, is available on the project object.

So, we could write one of the following as well:

  • project.task "myTask" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required