import javax.inject.Inject

class CustomTask extends DefaultTask {
    final String message
    final int number

    @Inject
    CustomTask(String message, int number) {
        this.message = message
        this.number = number
    }

    @TaskAction
    void printIt() {
        println("$message $number")
    }
}

// tag::task-container[]
tasks.create('myTask', CustomTask, 'hello', 42)
// end::task-container[]
