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