# afterTask

abstract fun afterTask(closure: Closure)

### Deprecated

Adds a closure to be called immediately after a task has executed. The task is passed to the closure as the first parameter. A org.gradle.api.tasks.TaskState is passed as the second parameter. Both parameters are optional.

#### Deprecated

This method is not supported when configuration caching is enabled.

#### Parameters

closure

The closure to execute when a task has been executed

abstract fun afterTask(action: Action<Task>)

### Deprecated

Adds an action to be called immediately after a task has executed. The task is passed to the action as the first parameter.

#### Deprecated

This method is not supported when configuration caching is enabled.

#### Since

3.1

#### Parameters

action

The action to execute when a task has been executed