# afterTask

abstract fun afterTask(closure: Closure)(source)

### Deprecated

This method is not supported when configuration caching is enabled.

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.

#### Since

0.7

#### Parameters

closure

The closure to execute when a task has been executed

abstract fun afterTask(action: Action<Task>)(source)

### Deprecated

This method is not supported when configuration caching is enabled.

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

#### Since

3.1

#### Parameters

action

The action to execute when a task has been executed