My first build.gradle for a 3D space graphics program I'm writing a 3D space graphics program and I just changed the build system to using gradle. This is my first gradle project. It works but I'm sure there is room for improvement. 

apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'eclipse'
apply plugin: 'idea'

mainClassName = 'spaceworld.UFOSpaceWorld'

repositories {
    jcenter()
}

ext.jmeVersion = "[3.1,)"

project(":assets") {
    apply plugin: "java"

    buildDir = rootProject.file("build/assets")

    sourceSets {
        main {
            resources {
                srcDir '.'
            }
        }
    }
}
repositories {
    mavenCentral()
    maven {
        url "https://mvnrepository.com/artifact/cz.advel.jbullet/jbullet"

    }
    maven {
        url 'http://nifty-gui.sourceforge.net/nifty-maven-repo'
    }

}



dependencies {

    compile "org.jmonkeyengine:jme3-core:$jmeVersion"
    compile "org.jmonkeyengine:jme3-desktop:$jmeVersion"
    compile "org.jmonkeyengine:jme3-lwjgl:$jmeVersion"
    compile "org.jmonkeyengine:jme3-blender:$jmeVersion"
    compile "org.jmonkeyengine:jme3-bullet:$jmeVersion"
    compile "org.jmonkeyengine:jme3-plugins:$jmeVersion"
    compile "org.jmonkeyengine:jme3-networking:$jmeVersion"
    compile 'lessvoid:nifty:1.4.1'
    compile 'lessvoid:nifty-default-controls:1.4.1'
    compile 'lessvoid:nifty-style-black:1.4.1'
    compile group: "cz.advel.jbullet", name: "jbullet", version: "20101010"
    compile files('libs/cai-nmgen-0.2.0.jar')
    compile files('libs/ext.bundle.opengl.jmonkey-1.1.3.jar')
    runtime project(':assets')
}

task wrapper(type: Wrapper) {
}

task createDirs &lt;&lt; {

    def pkg = 'spaceworld'
    def dirs = [
            file("./src/main/java/$pkg"),
            file("./src/main/resources"),
            file("./assets/Interface"),
            file("./assets/MatDefs"),
            file("./assets/Materials"),
            file("./assets/Effects"),
            file("./assets/Textures"),
            file("./assets/Models"),
            file("./assets/Scenes"),
            file("./assets/Shaders"),
            file("./assets/Sounds"),
            file("./assets/Textures"),
    ]

    dirs.each {
        if (!it.exists()) {
            println "Creating " + it
            it.mkdirs()
        }
        if (it.listFiles().length == 0) {
            def stub = new File(it, 'removeme.txt')
            println "Creating stub file to allow git checkin, file:$stub"
            stub.text = "Remove me when there are files here."
        }
    }
}
The part where you create directories with a single file removeme.txt doesn't belong in a build.gradle file of an Android project. This appears to be a one time setup for your project, specifically for using Git as the version control system. After a single execution followed by a commit, this code is pointless, it doesn't need to be executed again, so I suggest to put it in a separate helper script file.

It's a very minor thing, but to keep "empty"directories in Git, a common name for the place holder file seems to be .gitkeep