Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Gradle

task myTask(dependsOn: ['assembleDebug', 'assembleRelease']) {
    group 'My group'
    description 'My description'
    doLast {
        exec {
            executable "sh"
            args "-c", "runscript.sh"
        }
    }
}

In Kotlin

tasks.register("myTask") {
    doLast {
        val result = exec {
            commandLine("echo", "hi")
        }
        println(result.exitValue)
    }
}
  • Remove old-ish cache
find ~/.gradle -type f -atime +30 -delete
find ~/.gradle -type d -mindepth 1 -empty -delete