-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
build.gradle
258 lines (226 loc) · 9.75 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
import java.time.LocalDateTime
allprojects {
group APP_GROUP
version APP_VERSION
}
ext {
configuration = [
javaVersion = JavaVersion.VERSION_21
]
libraries = [
mybatisVersion = '3.5.16',
mybatisSpringVersion = '2.1.2',
mybatisSpringBootStarterVersion = '2.3.2',
springVersion = '5.3.39',
springBootVersion = '2.7.18',
springBoot3Version = '3.3.4',
springCloudVersion = '3.1.8',
junitVersion = '5.11.0',
]
lib = [
"kotlin-reflect" : "org.jetbrains.kotlin:kotlin-reflect:2.0.20",
"kotlin-stdlib-jdk8" : "org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.20",
"mybatis" : "org.mybatis:mybatis:${mybatisVersion}",
"mybatis-spring" : "org.mybatis:mybatis-spring:${mybatisSpringVersion}",
"mybatis-thymeleaf" : "org.mybatis.scripting:mybatis-thymeleaf:1.0.4",
"mybatis-freemarker" : "org.mybatis.scripting:mybatis-freemarker:1.3.0",
"mybatis-velocity" : "org.mybatis.scripting:mybatis-velocity:2.1.2",
"spring-context-support" : "org.springframework:spring-context-support:${springVersion}",
"spring-jdbc" : "org.springframework:spring-jdbc:${springVersion}",
"spring-tx" : "org.springframework:spring-tx:${springVersion}",
"spring-web" : "org.springframework:spring-web:${springVersion}",
"spring-aop" : "org.springframework:spring-aop:${springVersion}",
"cglib" : "cglib:cglib:3.3.0",
"imadcn" : "com.imadcn.framework:idworker:1.6.0",
"spring-cloud-commons" : "org.springframework.cloud:spring-cloud-commons:${springCloudVersion}",
"aspectjweaver" : "org.aspectj:aspectjweaver:1.9.22.1",
"slf4j-api" : "org.slf4j:slf4j-api:1.7.36",
//copy
"mybatis-spring-boot-starter": "org.mybatis.spring.boot:mybatis-spring-boot-starter:${mybatisSpringBootStarterVersion}",
//test
"spring-test" : "org.springframework:spring-test:${springVersion}",
"assertj-core" : "org.assertj:assertj-core:3.26.3",
"junit-jupiter" : "org.junit.jupiter:junit-jupiter:${junitVersion}",
"fastjson" : "com.alibaba:fastjson:2.0.53",
"jackson" : "com.fasterxml.jackson.core:jackson-databind:2.17.2",
"gson" : "com.google.code.gson:gson:2.11.0",
"lagarto" : "org.jodd:jodd-lagarto:6.0.6",
//datasource
"p6spy" : "p6spy:p6spy:3.9.1",
"sqlserver" : "com.microsoft.sqlserver:sqljdbc4:4.0",
"postgresql" : "org.postgresql:postgresql:42.7.4",
"oracle" : fileTree(dir: 'libs', includes: ['ojdbc8.jar']),
"dm" : fileTree(dir: 'libs', includes: ["jdbcDriver-18.jar"]),
"h2" : "com.h2database:h2:2.3.232",
"mysql" : "com.mysql:mysql-connector-j:9.0.0",
"sqlite" : "org.xerial:sqlite-jdbc:3.46.1.0",
"firebird" : "org.firebirdsql.jdbc:jaybird:5.0.5.java8",
//cache
"mybatis-caffeine" : "org.mybatis.caches:mybatis-caffeine:1.2.0",
//code generator
"velocity" : "org.apache.velocity:velocity-engine-core:2.4",
"freemarker" : "org.freemarker:freemarker:2.3.33",
"beetl" : "com.ibeetl:beetl:3.17.0.RELEASE",
"swagger-annotations" : "io.swagger:swagger-annotations:1.6.14",
"enjoy" : "com.jfinal:enjoy:5.2.2",
"logback-classic" : "ch.qos.logback:logback-classic:1.5.8",
]
}
description = "Mybatis 增强工具包 - 只做增强不做改变,简化CRUD操作"
subprojects {
apply plugin: 'java-library'
apply plugin: 'signing'
apply plugin: 'maven-publish'
apply plugin: 'tech.yanand.maven-central-publish'
apply plugin: "io.freefair.lombok"
sourceCompatibility = "${javaVersion}"
targetCompatibility = "${javaVersion}"
lombok {
version = "1.18.32"
}
compileJava {
options.release = 8
}
repositories {
mavenLocal()
maven { url "https://maven.aliyun.com/repository/public" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
mavenCentral()
}
dependencies {
testImplementation "${lib["assertj-core"]}"
testImplementation "${lib["junit-jupiter"]}"
testImplementation "org.mockito:mockito-junit-jupiter:5.13.0"
testImplementation "${lib["lagarto"]}"
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.warnings = false
options.deprecation = true
options.compilerArgs += ["-parameters"]
}
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
jar {
into("META-INF/") {
from rootProject.file("LICENSE")
}
into("META-INF/maven/$project.group/$project.name") {
from { generatePomFileForMavenJavaPublication }
rename ".*", "pom.xml"
}
afterEvaluate {
manifest {
attributes 'Implementation-Title': archiveBaseName
attributes 'Implementation-Version': archiveVersion
attributes 'Built-Gradle': gradle.gradleVersion
attributes 'Bundle-DocURL': 'https://baomidou.com/'
attributes 'Build-OS': System.getProperty("os.name")
attributes 'Built-By': System.getProperty("user.name")
attributes 'Build-Jdk': System.getProperty("java.version")
attributes 'Build-Timestamp': LocalDateTime.now().format("yyyy-MM-dd HH:mm:ss")
attributes 'Automatic-Module-Name': "${project.group}.${project.name.replaceAll("-", ".")}"
}
}
}
//noinspection GroovyAssignabilityCheck
task sourcesJar(type: Jar) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
javadoc {
afterEvaluate {
configure(options) {
encoding "UTF-8"
charSet 'UTF-8'
author true
version true
failOnError false
links "http://docs.oracle.com/javase/8/docs/api"
}
}
}
test {
dependsOn("cleanTest", "generatePomFileForMavenJavaPublication")
useJUnitPlatform()
exclude("**/phoenix/**")
exclude("**/postgresql/**")
// exclude("**/generator/**")
}
task cleanBuildDir(type: Delete) {
delete "${projectDir}/out"
}
tasks.clean.dependsOn(cleanBuildDir)
task javadocJar(type: Jar) {
archiveClassifier = 'javadoc'
from javadoc
}
tasks.whenTaskAdded { task ->
if (task.name.contains('signMavenJavaPublication')) {
task.enabled = new File(project.property('signing.secretKeyRingFile') as String).isFile()
}
}
publishing {
repositories {
maven {
name = "Local"
url = layout.buildDirectory.dir('repos/bundles')
}
}
// use example : ./gradlew clean build publish publishToMavenCentralPortal -DauthToken='xxxxxx' -x test
mavenCentral {
repoDir = layout.buildDirectory.dir('repos/bundles')
// Base64 encoded of "username:password"
authToken = System.getProperty("authToken")
// 默认自动发布 AUTOMATIC
publishingType = 'USER_MANAGED'
}
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
pom {
name = 'mybatis-plus'
packaging 'jar'
description = 'An enhanced toolkit of Mybatis to simplify development.'
url = 'https://github.com/baomidou/mybatis-plus'
scm {
connection = 'scm:[email protected]:Codearte/gradle-nexus-staging-plugin.git'
developerConnection = 'scm:[email protected]:Codearte/gradle-nexus-staging-plugin.git'
url = 'https://github.com/baomidou/mybatis-plus'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'baomidou'
name = 'hubin'
email = '[email protected]'
}
}
withXml {
def root = asNode()
root.dependencies.'*'.findAll {
def d = it
d.scope.text() == 'runtime' && project.configurations.findByName("implementation").allDependencies.find { dep ->
dep.name == it.artifactId.text()
}.each() {
d.scope*.value = 'compile'
d.appendNode('optional', true)
}
}
}
}
}
}
signing {
sign publishing.publications.mavenJava
}
}
}