-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.gradle
101 lines (82 loc) · 2.97 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
buildscript {
repositories {
if (project.hasProperty("maven") && maven.equals("maven.aliyun.com"))
// maven { url = 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url = 'https://maven.aliyun.com/repository/public'}
else
mavenCentral()
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.+")
}
}
}
apply plugin: 'org.springframework.boot'
group = 'com.incarcloud'
version = '1.2.7'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
if (project.hasProperty("maven") && maven.equals("maven.aliyun.com"))
maven { url = 'http://maven.aliyun.com/nexus/content/groups/public/' }
else
mavenCentral()
}
dependencies {
compile("org.springframework.boot:spring-boot-starter:1.5.+"){
exclude module: "spring-boot-starter-logging"
}
compile("org.springframework.boot:spring-boot-starter-log4j2:1.5.+")
compile("org.mongodb:mongodb-driver-sync:3.8.+")
compile("com.incarcloud:incar-vault:1.1.1")
compile group: 'com.alibaba', name: 'fastjson', version: '1.2.+'
compile files("lib/ojdbc8.jar")
runtime("com.github.jnr:jnr-unixsocket:0.19")
testImplementation("junit:junit:4.+")
}
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/incarcloud/saic/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/incarcloud/saic/GitVer.java"))
writer.print(javaFile)
writer.close()
}
}
compileJava{
dependsOn MarkGitVersion
options.encoding = "utf-8"
options.compilerArgs << "-Xlint:unchecked"
options.compilerArgs << "-Xdiags:verbose"
options.compilerArgs << "-proc:none"
}
compileTestJava{
options.encoding = "utf-8"
options.compilerArgs << "-Xlint:unchecked"
options.compilerArgs << "-Xdiags:verbose"
}
bootRun{
systemProperties System.getProperties()
}
test{
systemProperties System.getProperties()
testLogging {
events "passed", "skipped", "failed"
showStandardStreams = true
}
if(project.hasProperty("testCaseOnly")) {
filter {
includeTestsMatching testCaseOnly
}
}
}
defaultTasks "assemble"