How to execute shell command? source or dot doesn't work with exec

“sh”, “bash”, “zsh”, or whatever shell you want to use. For example:

task hello(type: Exec) {
  executable "sh"
  args "-c", "echo 'hello from your shell'"
}

For more information, see the documentation of your shell.