-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
151 lines (141 loc) · 6.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
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
145
146
147
148
149
150
151
import org.springframework.boot.gradle.tasks.run.BootRun
description = '依赖jar包'
buildscript {
dependencies {
classpath "io.spring.gradle:dependency-management-plugin:1.0.11.RELEASE"
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.5.1")
}
}
//配置所有项目公共内容
allprojects {
// 指定语言
apply plugin: 'java'
// 指定编辑器
apply plugin: 'idea'
// 配置项目信息
group 'org.thirteen'
// 项目版本
version '1.0-SNAPSHOT'
// 配置仓库
repositories {
mavenLocal()
maven { url "https://maven.aliyun.com/repository/public" }
maven { url "https://maven.springframework.org/release" }
mavenCentral()
}
}
// 所有子项目的通用配置
subprojects {
// 指定需要的插件
apply plugin: "io.spring.dependency-management"
apply plugin: 'org.springframework.boot'
/* 指定jdk版本 */
java.sourceCompatibility = JavaVersion.VERSION_13
java.targetCompatibility = JavaVersion.VERSION_13
// java编译的时候缺省状态下会因为中文字符而失败
[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'
def springCloudVersion = '2020.0.3'// spring-cloud包
def springCloudNacosVersion = '2021.1'// spring-cloud-alibaba-nacos
def springCloudZipkinVersion = '2.2.8.RELEASE'// spring-cloud-alibaba-zipkin
def springBootVersion = '2.5.1'// spring boot
def springDataVersion = '2.5.1'// spring-data
def springTestVersion = '5.3.8'// spring test 测试包
def junitVersion = '4.13.2'// Junit测试包
def hamcrestVersion = '2.2'// hamcrest
def jedisVersion = '3.6.1'// redis的java版本的客户端实现
def slf4jVersion = '2.0.0-alpha1'// 日志工具
def swaggerVersion = '3.0.0'// Springfox Swagger2基础包
def httpclientVersion = '4.5.13'// HTTP协议的客户端编程工具包
def jodaTimeVersion = '2.10.10'// 处理时间
def commonsLang3Version = '3.9'// java常用处理集
def commonsIoVersion = '2.10.0'// io处理
def commonsNetVersion = '3.8.0'// 下载功能
def commonsFileUploadVersion = '1.4'// 文件上传
def commonsCollections4Version = '4.4'// 集合工具类
def commonsCodecVersion = '1.15'// 加密库
def javaxServletVersion = '4.0.1'// javax.servlet
def lombokVersion = '1.18.20'// lombok
def geoip2Version = '2.15.0'// 通过IP反解国家省份城市工具
def jwtVersion = '3.16.0'// jwt
def jjwtVersion = '0.9.1'// jwt常用工具包
def dozerVersion = '5.5.1'// 对象转换工具
def ow2AsmVersion = '9.1'// 字节码操作工具类
dependencyManagement {
dependencies {
// spring-cloud-starter-alibaba-nacos-discovery,spring-cloud-starter-alibaba-nacos-config
dependencySet(group: 'com.alibaba.cloud', version: "$springCloudNacosVersion") {
entry 'spring-cloud-starter-alibaba-nacos-discovery'
entry 'spring-cloud-starter-alibaba-nacos-config'
}
dependency group: 'org.springframework.cloud', name: 'spring-cloud-starter-zipkin', version: "$springCloudZipkinVersion"
// spring-boot-starter-data-mongodb,spring test 测试包
dependencySet(group: 'org.springframework.boot', version: "$springBootVersion") {
entry 'spring-boot-starter-data-mongodb'
entry 'spring-boot-test'
}
// spring data redis,spring data jpa
dependencySet(group: 'org.springframework.data', version: "$springDataVersion") {
entry 'spring-data-redis'
entry 'spring-data-jpa'
}
dependency group: 'org.springframework', name: 'spring-test', version: "$springTestVersion"
// junit
dependency group: 'junit', name: 'junit', version: "$junitVersion"
dependency group: 'org.hamcrest', name: 'hamcrest-core', version: "$hamcrestVersion"
dependency group: 'org.hamcrest', name: 'hamcrest-library', version: "$hamcrestVersion"
// Redis客户端
dependency group: 'redis.clients', name: 'jedis', version: "$jedisVersion"
// 日志处理
dependency group: 'org.slf4j', name: 'slf4j-log4j12', version: "$slf4jVersion"
// springfox swagger2
dependencySet(group: 'io.springfox', version: "$swaggerVersion") {
entry 'springfox-swagger2'
entry 'springfox-swagger-ui'
}
// http client
dependency group: 'org.apache.httpcomponents', name: 'httpclient', version: "$httpclientVersion"
// 时间操作组件
dependency group: 'joda-time', name: 'joda-time', version: "$jodaTimeVersion"
// Apache工具组件
dependency group: 'org.apache.commons', name: 'commons-lang3', version: "$commonsLang3Version"
dependency group: 'commons-io', name: 'commons-io', version: "$commonsIoVersion"
dependency group: 'commons-net', name: 'commons-net', version: "$commonsNetVersion"
dependency group: 'commons-fileupload', name: 'commons-fileupload', version: "$commonsFileUploadVersion"
dependency group: 'org.apache.commons', name: 'commons-collections4', version: "$commonsCollections4Version"
dependency group: 'commons-codec', name: 'commons-codec', version: "$commonsCodecVersion"
// javax.servlet
dependency group: 'javax.servlet', name: 'javax.servlet-api', version: "$javaxServletVersion"
// 通过IP反解国家省份城市工具
dependency group: 'com.maxmind.geoip2', name: 'geoip2', version: "$geoip2Version"
// jwt
dependency group: 'com.auth0', name: 'java-jwt', version: "$jwtVersion"
// jwt常用工具包
dependency group: 'io.jsonwebtoken', name: 'jjwt', version: "$jjwtVersion"
// lombok
dependency group: 'org.projectlombok', name: 'lombok', version: "$lombokVersion"
// 对象转换工具
dependencySet(group: 'net.sf.dozer', version: "$dozerVersion") {
entry 'dozer'
entry 'dozer-spring'
}
// 字节码操作工具类
dependency group: 'org.ow2.asm', name: 'asm', version: "$ow2AsmVersion"
}
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
}
}
task bootDev(type: BootRun) {
classpath = sourceSets.main.runtimeClasspath
systemProperty 'spring.profiles.active', 'dev'
}
task bootTest(type: BootRun) {
classpath = sourceSets.main.runtimeClasspath
systemProperty 'spring.profiles.active', 'test'
}
task bootProd(type: BootRun) {
classpath = sourceSets.main.runtimeClasspath
systemProperty 'spring.profiles.active', 'prod'
}
}