I would like to run a task in farm task:
farm
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.
Copyright © 2021 Jogjafile Inc.
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:or:
Please have a look at the demo here.