buildscript { repositories { maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath "com.bmuschko:gradle-tomcat-plugin:2.2.4" } } subprojects { apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'maven-publish' repositories { mavenCentral() } tasks.withType(JavaCompile) { options.compilerArgs << '-Xlint:-options' } dependencies { testCompile 'junit:junit:4.12' } version = '3.1.4-RC1' jar { manifest.attributes provider: 'EGIZ', 'Specification-Version': getCheckedOutGitCommitHash(), 'Implementation-Version': project.version } compileJava { sourceCompatibility = 1.7 targetCompatibility = 1.7 } publishing { publications { mavenJava(MavenPublication) { from components.java // more goes in here } } repositories { maven { // change to point to your repo, e.g. http://my.org/repo url = "$buildDir/repo" } mavenLocal() } } } def getCheckedOutGitCommitHash() { def gitFolder = "$projectDir/../.git/" def takeFromHash = 40 def head = new File(gitFolder + "HEAD").text.split(":") def isCommit = head.length == 1 if(isCommit) return head[0].trim().take(takeFromHash) def refHead = new File(gitFolder + head[1].trim()) refHead.text.trim().take takeFromHash }