1 
   2 apply plugin:'application'
   3 
   4 def mainClassName = "ensemble.EnsembleApp"
   5 
   6 def FileCollection apachecp = files(
   7    "./lib/lucene-grouping-3.2.0.jar",
   8    "./lib/lucene-core-3.2.0.jar")
   9 
  10 sourceSets {
  11     main {
  12         java {
  13             srcDirs 'src/app/java',
  14                     'src/generated/java',
  15                     'src/samples/java'
  16         }
  17         resources {
  18             srcDirs 'src/app/resources',
  19                     'src/generated/resources',
  20                     'src/samples/resources'
  21         }
  22         compileClasspath += apachecp
  23     }
  24 }
  25 
  26 jar {
  27     manifest.attributes("Main-Class": mainClassName)
  28 
  29     // add in the sample sources....
  30     from fileTree('src/samples/java')
  31 
  32     // Note: this would be the "gradle" way to add in the Lucene jars
  33     // BUT we run into total path length on Windows with the temp file in ./build
  34     //apachecp.each { from zipTree(it) }
  35     //exclude 'META-INF/*'
  36 }
  37 
  38 // Merge the Apache Lucene jars into our master jar.
  39 jar.doLast() {
  40     ant.zip(destfile: jar.archivePath, update: true, duplicate: "preserve") {
  41         zipgroupfileset(dir: new File("./lib"), includes:"*.jar")
  42     }
  43 }
  44