Unable to use 'Delete' task type in a custom plugin

I’ve pared down my code considerably, but I have the following custom plugin:

import org.gradle.api.Plugin
import org.gradle.api.Project

class CheckmatePlugin implements Plugin<Project> {

    void apply(Project project) {

        project.extensions.create('checkmate', CheckmatePluginExtension)

        project.afterEvaluate {

            project.task('deleteTest', type: Delete) {

                delete repoBuildDir


When I use the custom plugin in a build script, I get the following:

A problem occurred configuring root project 'checkmate-template'.
> Cannot create task of type 'Delete' as it does not implement the Task interface.

Am I simply unable to use the built-in Task types inside a custom plugin? I can call my own custom task classes just fine.

Thank you.

Since the plugin is just Java/Groovy code, you have to import classes for the built in types. Try importing org.gradle.api.tasks.Delete

1 Like

Thanks Sterling… that did the trick. Keep forgetting this is basic development at the core.