allprojects { apply plugin: 'java' compileJava { sourceCompatibility = 1.8 targetCompatibility = 1.8 options.encoding = 'UTF-8' } repositories { mavenCentral() } } subprojects { ext { slf4j_version = '1.7.21' spring_version = '4.2.5.RELEASE' } configurations { compile_excludeCopy compile.extendsFrom compile_excludeCopy } dependencies { /* Logger */ compile (group: 'org.slf4j', name: 'slf4j-api', version: slf4j_version) compile (group: 'org.slf4j', name: 'jcl-over-slf4j', version: slf4j_version) /* Spring */ compile (group: 'org.springframework', name: 'spring-context', version: spring_version) { exclude group: 'commons-logging' } /* Components */ compile (group: 'org.projectlombok', name: 'lombok', version: '1.16.16') /* Test */ testCompile (group: 'junit', name: 'junit', version: '4.12') } task copyDep(type: Copy) { into 'libs' from configurations.compile + configurations.runtime - configurations.compile_excludeCopy } task cleanDep(type: Delete) { delete 'libs' } } task runApp(type: JavaExec) { main = 'mc.core.Main' workingDir = (project.hasProperty("workDir") ? project.workDir : '.') subprojects.findAll().each{ prj -> classpath += prj.sourceSets.main.runtimeClasspath } /* Uncomment, if your Log Implements are folder '{workDir}/log-impl' */ classpath += files(fileTree(dir: new File(workingDir, "log-impl"))) /* Uncomment, if you used VM args */ jvmArgs = [ "-DspringConfig=spring-flat.xml", "-Dlog4j.configurationFile=log4j2.xml" ] ignoreExitValue = true }