Gradle: create ZIP package with exec permissions

April 18, 2011

To create distribution zip package with executable permissions for script files (*.sh files in the example) use following gradle task:

// zip into build/distributions
def installDir=new File('./install')
task makeDist(type: Zip /*, dependsOn: [add your dependencies]*/) {
    //compression = Compression.GZIP // for Tar type
    from(installDir.toString()) {
    from(installDir.toString()) {
        fileMode = 0755

Before task is run, adjust dependencies to fill installDir with package content.

Tested with gradle-1.0-milestone2.

First post 🙂