gradle
8.6

# replace

abstract fun replace(name: String): Task(source)

Creates a Task with the given name and adds it to this container, replacing any existing task with the same name.

After the task is added, it is made available as a property of the project, so that you can reference the task by name in your build file.

#### Return

The newly created task object

#### Parameters

name

The name of the task to be created

#### See also

Project

More information about how tasks are exposed by name in build scripts

abstract fun <T : Task?> replace(name: String, type: Class<T>): T(source)

Creates a Task with the given name and type, and adds it to this container, replacing any existing task of the same name.

After the task is added, it is made available as a property of the project, so that you can reference the task by name in your build file.

#### Return

The newly created task object

#### Parameters

name

The name of the task to be created.

type

The type of task to create.

#### See also

Project

More information about how tasks are exposed by name in build scripts