For AI agents: the documentation index is at https://docs.gradle.org/llms.txt. Request any page with the header Accept: text/markdown to get Markdown. User manual pages are also available as Markdown by replacing .html with .md in the URL.

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

Since

0.7

Parameters

name

The name of the task to be created

See also

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

Since

0.7

Parameters

name

The name of the task to be created.

type

The type of task to create.

See also

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