Try this in a build.gradle script

class RecTask extends org.gradle.api.internal.AbstractTask {
 public Task configure(Closure closure) {
  println "configuring.."
  return ConfigureUtil.configure(closure, this, true);
    }
}
  task rectask(type: RecTask) {}