Thank you Ildar.
I actually had to do this:
myTask = task(type: SshTask) { }
myTask.with {
user = server.user
host = server.host
command = "mkdir -vp $server.dir"
}
myTask.execute()
While this works, it's cumbersome and I'm not sure it's "the Gradle way". I
won't be surprised if it breaks in the future.
myTask.with can be replaced by myTask.configure and works just as well for
my use case.
The adhoc task is named like
"build_73qscsirv2k4ajt9o1pf1hrome$_run_closure3_closure4_closu...@31bcc8".
The "concise" version is like this, which also works:
task(type: SshTask) { }.configure {
user = server.user
host = server.host
command = "mkdir -vp $server.dir"
}.execute()
The closure is needed, leaving out the closure makes it not working. i.e.
this won't work:
myTask = task(type: SshTask)
-----
http://www.HendyIrawan.com
--
View this message in context:
http://gradle.1045684.n5.nabble.com/How-to-run-ad-hoc-anonymous-task-without-naming-the-task-tp3332909p3334625.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