Is it ok to set task classes as properties for convenience when writing plugins?

Like in

public void apply(Project project) {
    project.with {
        ext {
            MyTask =
        // ...

so when people use the plugin, they can just go:

apply plugin: 'my-plugin'
  task myTask(type: MyTask)

I’m just wondering about the ramifications this might have.

It’s generally not a good idea.

Plugins shouldn’t touch the ‘ext’ space because it’s a flat namespace and is difficult to trace. That is, in the case of a naming conflict it’s going to be difficult for the user to debug what’s going on.

I’d recommend putting all your tasks in one package and having the user do a star import.