-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
103 lines (81 loc) · 1.96 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
buildscript {
ext {
springBootVersion = '1.3.2.RELEASE'
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("se.transmode.gradle:gradle-docker:1.2")
}
}
apply plugin: 'java'
apply plugin: 'spring-boot'
apply plugin: 'application'
apply plugin: 'docker'
group = 'aranga' //need to change to your docker account or group
def jarTagName = "1.0"
sourceSets{
main{
java{
srcDir "microservices/src/main/java"
}
resources{
srcDir "microservices/src/main/resources"
}
}
test{
java{
srcDir "microservices/src/test/java"
}
resources{
srcDir "microservices/src/test/resources"
}
}
}
jar {
jarTagName= java.lang.System.getProperty("TAG");
if (jarTagName == null)
jarTagName ="1.0.0"
baseName = 'spring-boot'
version = jarTagName
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
//To use log4
compile("org.springframework.boot:spring-boot-starter-web"){
exclude module: "spring-boot-starter-logging" //remove the LogBack
}
//its part spring-boot-starter-web
//end log4j configuration
compile ("org.springframework.boot:spring-boot-starter-data-jpa"){
exclude module: "spring-boot-starter-logging" //remove LogBack
}
compile("org.springframework.boot:spring-boot-starter-log4j") //finally log4j lib
compile("mysql:mysql-connector-java:5.1.38")
//uncomment following line to use ms sql jdbc
//refer to the read me note
//compile("com.microsoft.sql:sqljdbc:4.0.0")
testCompile("org.springframework.boot:spring-boot-starter-test")
}
task wrapper(type: Wrapper) {
gradleVersion = '2.6'
}
task buildDocker(type: Docker, dependsOn: build) {
push = true
applicationName = jar.baseName
tagVersion = jarTagName
dockerfile = file('microservices/src/main/docker/Dockerfile')
doFirst {
copy {
from jar
into stageDir
}
}
}
compileJava.dependsOn clean