Skip to content

Instantly share code, notes, and snippets.

@robpurcell
Created July 14, 2012 09:54
Show Gist options
  • Save robpurcell/3110305 to your computer and use it in GitHub Desktop.
Save robpurcell/3110305 to your computer and use it in GitHub Desktop.
Minimal Gradle Build file for Groovy project creation
apply plugin: 'groovy'
apply plugin: 'idea'
task initProject(description: 'Initialize project directory structure.') << {
// Default package to be created in each src dir.
def defaultPackage = 'com/robbyp/greg'
['java', 'groovy', 'resources'].each {
// convention.sourceSets contains the directory structure
// for our Groovy project. So we use this struture
// and make a directory for each node.
sourceSets*."${it}".srcDirs*.each { dir ->
def newDir = new File(dir, defaultPackage)
logger.info "Creating directory $newDir" // gradle -i shows this message.
newDir.mkdirs() // Create dir.
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '1.0'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment