# Interface TaskExecutionListener

All Known Implementing Classes:
  `TaskExecutionAdapter`

@Deprecated public interface TaskExecutionListener
Deprecated.
This type is not supported when configuration caching is enabled.

A `TaskExecutionListener` is notified of the execution of the tasks in a build.

You can add a `TaskExecutionListener` to a build using `TaskExecutionGraph.addTaskExecutionListener(TaskExecutionListener)`

This listener type is not supported when the configuration cache is enabled. To receive task completion events in a compatible way, use a `BuildService` that implements `OperationCompletionListener` and register it via `BuildEventsListenerRegistry`.

Since:
  0.7

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `afterExecute(Task task, TaskState state)`
  Deprecated.
  This method is called immediately after a task has been executed.
  `void`
  `beforeExecute(Task task)`
  Deprecated.
  This method is called immediately before a task is executed.

- ## Method Details

  - ### beforeExecute

    void beforeExecute(Task task)
    Deprecated.
    This method is called immediately before a task is executed.
    Parameters:
      `task` - The task about to be executed. Never null.
    Since:
      0.7

  - ### afterExecute

    void afterExecute(Task task, TaskState state)
    Deprecated.
    This method is called immediately after a task has been executed. It is always called, regardless of whether the task completed successfully, or failed with an exception.
    Parameters:
      `task` - The task which was executed. Never null.
      `state` - The task state. If the task failed with an exception, the exception is available in this state. Never null.
    Since:
      0.9