apply plugin: 'java' apply plugin: 'maven-publish' apply plugin: 'eclipse' group='ch.systemsx.cisd' version='1.0' sourceSets { main { java { srcDirs = ['source/java'] } resources { srcDirs = ['resource'] } } test { java { srcDirs = ['sourceTest/java'] } } } dependencies { compile 'commons-io:commons-io:1.4', 'commons-lang:commons-lang:2.4', 'org.testng:testng:6.8', 'com.beust:jcommander:1.29', 'ch.rinn:restrictions:1.0.1' } eclipse { classpath { downloadSources=true defaultOutputDir = file('targets') } } repositories { maven { url 'http://localhost:8081/artifactory/gradle' } } def nativeDirectory def os = System.getProperty("os.name").toLowerCase() if (os.contains("mac os")) { println 'OS X detected'; nativeDirectory='x86_64-Mac OS X' } else { println 'Linux detected'; nativeDirectory='amd64-Linux' } tasks.withType(Test) { systemProperty "java.library.path", "native/native/unix/${nativeDirectory}:native/native/nativedata/${nativeDirectory}" } test { useTestNG() options { suites(file('sourceTest/java/tests.xml')) } } jar { from "native" } task sourceJar(type: Jar) { from sourceSets.main.allJava } publishing { publications { mavenJava(MavenPublication) { from components.java artifact sourceJar { classifier "sources" } } } repositories { maven { url 'http://localhost:8081/artifactory/gradle-local' credentials { username = 'deployer' password = 'deployer' } } } } publish { dependsOn build }