Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
23295 ashik.ali 1
apply plugin: 'java'
2
apply plugin: 'maven'
3
//apply plugin: 'war'
4
apply plugin: "eclipse"
5
//apply plugin: 'application'
6
 
7
group = 'com.profitmandi'
8
version = '0.0.1-SNAPSHOT'
9
 
10
description = """profitmandi-scheduler"""
11
 
12
sourceCompatibility = 1.8
13
targetCompatibility = 1.8
14
 
15
 
16
repositories {
17
 
18
     maven { url "http://repo.maven.apache.org/maven2" }
19
     mavenLocal()
20
}
21
 
22
task run{
23
	Set environments = ["dev", "staging", "prod"]
24
	def environment = "dev"
25
    if ( project.hasProperty("env") ) {
26
    	environment = project.getProperty("env")
27
    	if(!environments.contains(environment)){ 
28
    		logger.warn("Invalid Environment value, Choose any 'dev', 'staging', 'prod'");
29
    		environment = "dev"
30
    	} 
31
    }else{ 
32
    	logger.warn("Invalid key")
33
    }
34
    ant.propertyfile( file: "src/main/resources/META-INF/env.property"){
35
		entry( key: "profile", value: environment)
36
	}
37
	logger.info("Build is being build by "+environment)
38
}
39
 
40
tasks.build.doLast(){
41
	ant.propertyfile( file: "src/main/resources/META-INF/env.property"){
42
		entry( key: "profile", value: "dev")
43
	}
44
}
45
 
46
dependencies {
47
    compile project (':profitmandi-common')
48
    compile project (':profitmandi-dao')
49
}
50
 
51
 
52
// copy dependency jars to build/libs/dependency-jars
53
task copyJarsToLib (type: Copy) {
54
    def toDir = "build/libs/dependency-jars"
55
 
56
    // create directories, if not already done:
57
    file(toDir).mkdirs()
58
 
59
    // copy jars to lib folder:
60
    from configurations.compile
61
    into toDir
62
}
63
 
64
 
65
jar {
66
    // exclude log properties (recommended)
67
    exclude ("log4j.properties")
68
 
69
    // make jar executable: see http://stackoverflow.com/questions/21721119/creating-runnable-jar-with-gradle
70
    manifest {
71
        attributes (
72
            //'Main-Class': project.getProperty("mainClassName"),
73
            "Class-Path": '. dependency-jars/' + configurations.compile.collect { it.getName() }.join(' dependency-jars/')
74
            )
75
    }
76
}
77
 
78
// always call copyJarsToLib when building jars:
79
jar.dependsOn copyJarsToLib