-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
87 lines (74 loc) · 2.62 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
group 'com.evcar'
version '1.0'
buildscript {
repositories {
if (project.hasProperty("maven")) {
if (maven.equals("maven.aliyun.com"))
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
else
mavenCentral()
} else {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.+")
}
}
}
apply plugin: 'org.springframework.boot'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
if (project.hasProperty("maven")) {
if (maven.equals("maven.aliyun.com"))
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
else
mavenCentral()
} else {
mavenCentral()
}
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web:1.5.+"){
exclude module: "spring-boot-starter-logging"
}
compile("org.springframework.boot:spring-boot-starter-log4j2:1.5.+")
compile("com.alibaba:fastjson:1.2.+")
compile("org.apache.poi:poi-ooxml:3.+")
compile("org.elasticsearch:elasticsearch:2.3.+")
compile("org.asynchttpclient:async-http-client:2.0.+")
testCompile("junit:junit:4.12")
testCompile("org.springframework.boot:spring-boot-starter-test:1.5.+")
}
task MarkGitVersion{
doLast{
def git = "git -C " + projectDir + " "
def branch = (git + "symbolic-ref --short HEAD").execute().text.trim()
def rev = (git + "rev-list --count HEAD").execute().text.trim()
def hash = (git + "rev-parse --short HEAD").execute().text.trim()
def hash160 = (git + "rev-parse HEAD").execute().text.trim()
println("\tMark Git Version: " + branch + "." + rev + "@" + hash)
def javaFile = new File(projectDir, "src/main/java/com/evcar/subsidy/GitVer.jav_").text
javaFile = javaFile
.replace("\$branch\$", branch)
.replace("\$rev\$", rev)
.replace("\$hash\$", hash)
.replace("\$hash160\$", hash160)
def writer = new PrintWriter(new File(projectDir, "src/main/java/com/evcar/subsidy/GitVer.java"))
writer.print(javaFile)
writer.close()
}
}
compileJava{
dependsOn MarkGitVersion
options.encoding = "utf-8"
options.compilerArgs << "-Xlint:unchecked"
}
test {
systemProperties System.getProperties()
testLogging {
events "passed", "skipped", "failed"
showStandardStreams = true
}
}
defaultTasks "assemble"