Blame | Last modification | View Log | RSS feed
apply plugin: 'java'apply plugin: 'maven'//apply plugin: 'war'apply plugin: "eclipse"//apply plugin: 'application'group = 'com.profitmandi'version = '0.0.1-SNAPSHOT'description = """profitmandi-scheduler"""sourceCompatibility = 1.8targetCompatibility = 1.8repositories {maven { url "http://repo.maven.apache.org/maven2" }mavenLocal()}task run{Set environments = ["dev", "staging", "prod"]def environment = "dev"if ( project.hasProperty("env") ) {environment = project.getProperty("env")if(!environments.contains(environment)){logger.warn("Invalid Environment value, Choose any 'dev', 'staging', 'prod'");environment = "dev"}}else{logger.warn("Invalid key")}ant.propertyfile( file: "src/main/resources/META-INF/env.property"){entry( key: "profile", value: environment)}logger.info("Build is being build by "+environment)}tasks.build.doLast(){ant.propertyfile( file: "src/main/resources/META-INF/env.property"){entry( key: "profile", value: "dev")}}dependencies {compile project (':profitmandi-common')compile project (':profitmandi-dao')}// copy dependency jars to build/libs/dependency-jarstask copyJarsToLib (type: Copy) {def toDir = "build/libs/dependency-jars"// create directories, if not already done:file(toDir).mkdirs()// copy jars to lib folder:from configurations.compileinto toDir}jar {// exclude log properties (recommended)exclude ("log4j.properties")// make jar executable: see http://stackoverflow.com/questions/21721119/creating-runnable-jar-with-gradlemanifest {attributes (//'Main-Class': project.getProperty("mainClassName"),"Class-Path": '. dependency-jars/' + configurations.compile.collect { it.getName() }.join(' dependency-jars/'))}}// always call copyJarsToLib when building jars:jar.dependsOn copyJarsToLib