dependsOn(':elasticsearch') usePlugin 'java' archivesBaseName = "elasticsearch-attachments" explodedDistDir = new File(distsDir, 'exploded') manifest.mainAttributes("Implementation-Title": "ElasticSearch::Plugins::Attachments", "Implementation-Version": rootProject.version, "Implementation-Date": buildTimeStr) configurations.compile.transitive = true configurations.testCompile.transitive = true // no need to use the resource dir sourceSets.main.resources.srcDir 'src/main/java' sourceSets.test.resources.srcDir 'src/test/java' configurations { dists distLib { visible = false transitive = false } } dependencies { compile project(':elasticsearch') compile('org.apache.tika:tika-app:0.6') { transitive = false } distLib('org.apache.tika:tika-app:0.6') { transitive = false } testCompile project(':test-testng') testCompile('org.testng:testng:5.10:jdk15') { transitive = false } testCompile 'org.hamcrest:hamcrest-all:1.1' } test { useTestNG() jmvArgs = ["-ea", "-Xmx1024m"] options.suiteName = project.name options.listeners = ["org.elasticsearch.util.testng.Listeners"] options.systemProperties = [ "es.test.log.conf": System.getProperty("es.test.log.conf", "log4j-gradle.properties") ] } task explodedDist(dependsOn: [jar], description: 'Builds the plugin zip file') << { [explodedDistDir]*.mkdirs() copy { from configurations.distLib into explodedDistDir } // remove elasticsearch files (compile above adds the elasticsearch one) ant.delete { fileset(dir: explodedDistDir, includes: "elasticsearch-*.jar") } copy { from libsDir into explodedDistDir } } task zip(type: Zip) { dependsOn explodedDist // classifier = 'all' } zip.doFirst {task -> zipRootFolder = "" // its the plugin, don't create it under a specific name task.configure { zipFileSet(dir: explodedDistDir, prefix: zipRootFolder) { // just copy over everything } } } task release(dependsOn: [zip]) << { ant.delete(dir: explodedDistDir) copy { from distsDir into(new File(rootProject.distsDir, "plugins")) } }