I have a gradle build setup at the beginning of which I want to execute a shellscript in a subdirectory that prepares my environment.
task build << {
This works for me in my Android project
preBuild.doFirst { println("Executing myScript") def proc = "mySubDir/myScript.sh".execute() proc.waitForProcessOutput(System.out, System.err) }
See here for explanation: How to make System command calls in Java/Groovy?