import org.mdonoughe.JGitDescribeTask def jgit = new org.mdonoughe.JGitDescribeTask() jgit.setDir(new File("$projectDir", '.git')) project.version = jgit.getDescription() + '-SNAPSHOT' apply plugin: 'java' apply plugin: 'maven-publish' group = 'com.dmdirc' sourceSets { main { java.srcDirs = ['src'] resources.srcDirs = ['res'] } test { java.srcDirs = ['test'] resources.srcDirs = ['test-res'] } } sourceCompatibility = 1.8 targetCompatibility = 1.8 repositories.mavenCentral() dependencies { compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.0' testCompile group: 'junit', name: 'junit', version: '4.11' testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.5' testCompile group: 'com.google.jimfs', name: 'jimfs', version: '1.0' } publishing { publications { mavenJava(MavenPublication) { from components.java } } repositories { maven { name 'snapshots' url 'http://artifactory.dmdirc.com/artifactory/repo' } } } task wrapper(type: Wrapper) { gradleVersion = '2.2.1' } task getCredentials << { def target = file('nexus-teamcity.gradle') if (!target.exists()) { new URL('http://www.dmdirc.com/private/nexus-teamcity.gradle').withInputStream{ i -> target.withOutputStream { it << i } } } apply from: 'nexus-teamcity.gradle' project.publishing.repositories[0].credentials { username "$nexusUser" password "$nexusPass" } } task publishSnapshot(dependsOn: ['getCredentials', 'publishMavenJavaPublicationToSnapshotsRepository']) << { } buildscript { repositories { mavenCentral() maven { url 'http://artifactory.dmdirc.com/artifactory/repo' } } dependencies { classpath group: 'com.github.shanemcc', name: 'jgit-describe', version: '0.5' classpath group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '2.3.1.+' } }