Hello!
I know I`m not good in Java but all I want for now is to create Class which
will work as task instead of:
project.getTasks().add("myTask")
project.myTask << {
...
}
I want:
MyTask myTask = project.getTasks().add("myTask", MyTask.class);
myTask.dependsOn(...)
I`m trying to accomplish that like this:
public class MyTask extends AbstractTask{
void execute(){
...
}
}
The problem is with methods I need to implement like doFirst. I tried to
write it like this:
Task doFirst(Closure action) {
if (action == null) {
throw new InvalidUserDataException("Action must not be null!");
}
actions.add(0, convertClosureToAction(action));
return this;
}
The build is running but this is ignored after then:
myTask.doFirst {
println "working???"
}
What am I doing wrong? Please help!
btw, all is done from custom plugin.
--
View this message in context:
http://old.nabble.com/How-to-write-custom-Task-class-tp26716825p26716825.html
Sent from the gradle-user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email