apply plugin: "java"
+apply plugin: "war"
apply plugin: "jacoco"
apply plugin: "idea"
sourceCompatibility = 1.8
targetCompatibility = 1.8
+buildscript {
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ classpath group: "org.ajoberstar", name: "gradle-git", version: "1.1.0"
+ }
+}
+
repositories {
mavenCentral()
}
compile group: "com.fasterxml.jackson.core", name: "jackson-core", version: "2.1.2"
compile group: "com.fasterxml.jackson.core", name: "jackson-annotations", version: "2.1.2"
compile group: "com.fasterxml.jackson.core", name: "jackson-databind", version: "2.1.2"
+ compile group: "com.google.inject", name: "guice", version: "4.0"
testCompile group: "junit", name: "junit", version:"4.12"
testCompile group: "org.hamcrest", name: "hamcrest-library", version:"1.3"
)
}
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
+ from { sourceSets.generated.resources.srcDirs }
with jar
dependsOn test
}
+task createVersion() {
+ sourceSets {
+ generated {
+ resources {
+ srcDir "src/generated/resources"
+ }
+ }
+ }
+ processResources.dependsOn(createVersion)
+}
+
+
+import org.ajoberstar.grgit.Grgit
+createVersion << {
+ def gitRepo = Grgit.open(".")
+ version = gitRepo.describe()
+ new File("src/generated/resources").mkdirs()
+ new File("src/generated/resources/version.txt").withWriter() { it.write(version) }
+}
+
+war {
+ classpath sourceSets.generated.output
+ dependsOn(test)
+}
+
/* vim: set ts=4 sw=4 et: */