I would like to run a task in farm
task:
farm {
// run my task here.
}
Can anyone help me with this?
farm
is an extension - not a task - so it cannot be run. Also mind the fact that it's not good idea, nor good practice to run task programmatically. You need to define your own task and then define a dependency:
task myTask << {
println "Here's an action"
}
farmRun.dependsOn myTask
or:
task myTask << {
println "Here's an action"
}
project.afterEvaluate {
farmRun.dependsOn myTask
}
Please have a look at the demo here.