api / org.gradle.api.tasks / TaskContainer / replace

replace

abstract fun replace(name: String): Task

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. See here for more details.

Parameters

name - The name of the task to be created

Return
The newly created task object

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

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. See here for more details.

Parameters

name - The name of the task to be created.

type - The type of task to create.

Return
The newly created task object