What I currently have is:
task myTask (type : Exec) { executable \"something.sh\" ... (a lot of other things) args \"-t\" args ext.target } task
You can do something like the following:
def doMyThing(String target) { exec { executable "something.sh" args "-t", target } } task doIt { doLast { doMyThing("/tmp/foo") doMyThing("/tmp/gee") } }
The exec here is not a task, it's the Project.exec() method.
exec