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' repositories { mavenCentral() } dependencies { testCompile 'junit:junit:4.8.2' } version = '3.1.0' jar { manifest.attributes provider: 'EGIZ', 'Specification-Version': getCheckedOutGitCommitHash(), 'Implementation-Version': project.version } } task wrapper(type: Wrapper) { gradleVersion = '2.8' } 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 }