-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
144 lines (128 loc) · 4.46 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
buildscript {
repositories {
mavenLocal()
// https://maven.aliyun.com/mvn/view
maven { url 'https://maven.aliyun.com/repository/public' }
jcenter()
mavenCentral()
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://plugins.gradle.org/m2/' }
}
}
import java.nio.file.Files
import java.nio.file.Paths;
plugins {
id 'java'
id 'application'
id 'idea'
id 'checkstyle'
id 'com.github.sherter.google-java-format' version '0.8'
id 'org.springframework.boot' version '2.1.4.RELEASE'
id "io.freefair.lombok" version "3.5.2"
id "io.spring.dependency-management" version "1.0.7.RELEASE"
}
allprojects {
repositories {
mavenLocal()
maven { url 'https://maven.aliyun.com/repository/public' }
jcenter()
mavenCentral()
maven { url 'http://repo.spring.io/release' }
maven { url 'http://repo.spring.io/milestone' }
maven { url 'http://repo.spring.io/snapshot' }
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'idea'
apply plugin: 'io.freefair.lombok'
dependencies {
// spring boot
implementation 'org.springframework.boot:spring-boot-starter-web:2.1.4.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf:2.1.4.RELEASE'
implementation 'org.springframework.boot:spring-boot-devtools:2.1.4.RELEASE'
implementation 'org.springframework.data:spring-data-commons:2.1.4.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-aop:2.1.4.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-logging:2.1.4.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-actuator:2.1.4.RELEASE'
// database
implementation 'org.mybatis:mybatis:3.5.1'
implementation 'mysql:mysql-connector-java:8.0.16'
implementation 'com.zaxxer:HikariCP:3.3.1'
// tool
implementation 'com.github.pagehelper:pagehelper-spring-boot-starter:1.2.11'
implementation 'com.github.pagehelper:pagehelper:5.1.9'
implementation 'org.projectlombok:lombok:1.18.8'
// You should not configure `management.server.port` in application*.yml, or swagger-ui will not work properly.
implementation ('io.springfox:springfox-swagger2:2.9.2') {
exclude group: 'io.swagger', module: 'swagger-models'
}
implementation 'io.swagger:swagger-models:1.6.1'
implementation 'io.springfox:springfox-swagger-ui:2.9.2'
// util
implementation 'commons-lang:commons-lang:2.6'
implementation 'cn.hutool:hutool-core:4.5.10'
implementation 'cn.hutool:hutool-json:4.5.10'
implementation 'cn.hutool:hutool-http:4.5.10'
// test
testImplementation 'junit:junit:4.12'
testImplementation 'org.springframework.boot:spring-boot-starter-test:2.1.4.RELEASE'
}
/**
* Watch java files' changes, and recompile
*
* ```
* ./gradlew pro-*:watchJava -t
* ./gradlew pro-*:watchJava --continuous
* ```
*/
// noinspection GroovyAssignabilityCheck
task watchJava(type: GradleBuild) {
description "Watch java files' changes, and recompile."
inputs.files 'src/main/java'
tasks = ['compileJava']
}
}
def mbgMapperExcludePath = 'pro-mbg/src/main/java/dr/sbs/mbg/mapper/'
def mbgModelExcludePath = 'pro-mbg/src/main/java/dr/sbs/mbg/model/'
def mdbMbgMapperExcludePath = 'pro-mdbmbg/src/main/java/dr/sbs/mdbmbg/mapper/'
def mdbMbgModelExcludePath = 'pro-mdbmbg/src/main/java/dr/sbs/mdbmbg/model/'
googleJavaFormat {
toolVersion = "1.7"
exclude mbgMapperExcludePath
exclude mbgModelExcludePath
exclude mdbMbgMapperExcludePath
exclude mdbMbgModelExcludePath
}
checkstyle {
toolVersion '8.21'
}
/**
* checkstyle all java files
*
* @note - Task[Checkstyle] depends on Plugin[checkstyle]
* - Checkstyle does not have functionality of auto-fixing
*/
// noinspection GroovyAssignabilityCheck
task checkJava(type: Checkstyle) {
configFile = file('config/checkstyle/checkstyle.xml')
classpath = files()
source './'
exclude mbgMapperExcludePath
exclude mbgModelExcludePath
exclude mdbMbgMapperExcludePath
exclude mdbMbgModelExcludePath
if (System.properties.checkJavaInclude != null) {
def s = ((String)System.properties.checkJavaInclude).split(',')
def i = Arrays.asList(s)
include i
}
}
try {
// Copy git pre-commit hook
if (Files.exists(Paths.get('.git')) && !Files.exists(Paths.get('.git/hooks/pre-commit'))) {
Files.copy(Paths.get('config/hooks/pre-commit-stub'), Paths.get('.git/hooks/pre-commit'));
}
}
catch (e) {}