If what You need to do is a pretty standard task it's better to use Gradle's Exec
. It's just a wrapper that also starts a command under the hood.
If what You're looking for is a better control or untypical command or maybe a dedicated handling of result it better to use execute()
on String
(but it's better to pass command as a List
to avoid parser issues). It's more low level and needs more coding.