root/build.gradle @ a7cde4d15539d912dd4f72f9afaaa9e317365557

Revision a7cde4d15539d912dd4f72f9afaaa9e317365557, 1.9 kB (checked in by U-craigzor\craig <craig@…>, 8 months ago)

initial commit

  • Property mode set to 100755
RevLine 
[a7cde4d]1usePlugin 'groovy'
2usePlugin 'maven'  // Maven plugin to install artifact in local Maven repo.
3
4sourceCompatibility = '1.6'
5targetCompatibility = '1.6'
6
7manifest.mainAttributes("Main-Class" : "org.mindscratch.mrhakibook.ParseMain")
8
9def localMavenRepo = 'file://' + new File(System.getProperty('user.home'), '.m2/repository').absolutePath
10repositories {
11    // Use local Maven repo location. We don't need this if we only want to install
12    // an artifact, but we do need it if we want to use dependencies from the local
13    // repository.
14    mavenRepo urls: localMavenRepo
15}
16
17// Project configuration:
18version = '1.0-SNAPSHOT'
19group = 'org.mindscratch.mrhakibook'
20
21// The following line is not necessary. Default the install tasks depends on the
22// jar task, but this means no tests and checks are executed when we use the
23// install task. The following line makes the install tasks depend on the build task
24// and now all tests and checks are done before install is executed.
25install.dependsOn ':build'
26
27
28repositories {
29    mavenCentral()  // Define Maven central repository to look for dependencies.
30}
31
32dependencies {
33    groovy 'org.codehaus.groovy:groovy:1.6.7'  // group:name:version is a nice shortcut notation for dependencies.
34    testCompile 'junit:junit:4.7'
35}
36
37
38task initProject(description: 'Initialize project directory structure.') << {
39    // Default package to be created in each src dir.
40    def defaultPackage = 'org/mindscratch/mrhakibook'
41   
42    ['java', 'groovy', 'resources'].each {
43        // convention.sourceSets contains the directory structure
44        // for our Groovy project. So we use this struture
45        // and make a directory for each node.
46        convention.sourceSets.all."${it}".srcDirs*.each { dir ->
47            def newDir = new File(dir, defaultPackage)
48            logger.info "Creating directory $newDir"  // gradle -i shows this message.
49            newDir.mkdirs()  // Create dir.
50        }
51    }
52}
Note: See TracBrowser for help on using the browser.