apply plugin: 'java' apply plugin: 'war' sourceCompatibility = 1.8 //version = '1.0' logging.captureStandardOutput LogLevel.INFO repositories { mavenCentral() mavenLocal() } test { testLogging { exceptionFormat = 'full' } } dependencies { testCompile group: 'junit', name: 'junit', version: '4.11' compile 'org.apache.commons:commons-compress:1.9' compile 'org.tukaani:xz:1.5' compile 'javax:javaee-api:7.0' compile 'commons-io:commons-io:2.4' compile 'commons-codec:commons-codec:1.10' compile 'eu.webtoolkit:jwt:3.3.4' compile 'org.projectlombok:lombok:1.16.4' compile 'commons-fileupload:commons-fileupload:1.3.1' compile 'org.ops4j.orient:orient-ra-api:0.3.0' testCompile 'com.thoughtworks.xstream:xstream:1.4.8' testCompile 'org.jboss.resteasy:resteasy-jaxrs:3.0.11.Final' testCompile 'org.jboss.resteasy:resteasy-client:3.0.11.Final' testCompile 'org.jboss.resteasy:resteasy-jackson-provider:3.0.11.Final' testCompile 'org.jboss.resteasy:resteasy-jaxb-provider:3.0.11.Final' testCompile files('/opt/wildfly/bin/client/jboss-client.jar') } task deployWildfly(dependsOn: 'war') << { def username = 'admin', password = '123456' def sout = new StringBuffer(), serr = new StringBuffer() def cmd = sprintf("/opt/wildfly/bin/jboss-cli.sh --connect --user=%s --password=%s --command=\'deploy %s --force\'", username, password, tasks['war'].archivePath) def proc = cmd.execute() proc.consumeProcessOutput(sout, serr) proc.waitFor() if(proc.exitValue() != 0) { println "$serr" throw new RuntimeException("Error occurred during deployment") } } // client.jar task clientJar(type: Jar) { from(sourceSets.main.output) { archiveName project.name + "-common.jar" include 'org/jpacrepo/model/**', 'org/jpacrepo/pacbase/**', 'org/jpacrepo/context/ApplicationContext.class' } } // server.jar task serverJar(type: Jar) { from(sourceSets.main.output) { } }