-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubprojects.gradle
115 lines (103 loc) · 3.02 KB
/
subprojects.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
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
// 设置Java编译选项
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
// 设置统一的字符编码
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
}
tasks.withType(Javadoc).configureEach {
options.encoding = "UTF-8"
}
// 设置为永远不是最新状态来强制它们在每次构建时执行
gradle.taskGraph.whenReady { taskGraph ->
def tasks = taskGraph.getAllTasks()
tasks.each {
it.outputs.upToDateWhen { false }
}
}
// 打源码包、Javadoc包
java {
withJavadocJar()
withSourcesJar()
}
// 忽略 Javadoc 警告
/*tasks.withType(Javadoc).configureEach {
options.addBooleanOption('Xdoclint:none', true)
options.addBooleanOption('quiet', true)
}*/
// 子模块自定义, 默认是开启
bootJar {
enabled = false
}
repositories {
maven {
allowInsecureProtocol = true
url REPOSITORY_URL
}
maven {
credentials {
username findProperty("mavenUsername")?.toString() ?: ""
password findProperty("mavenPassword")?.toString() ?: ""
}
allowInsecureProtocol = true
url RELEASE_URL
}
maven {
credentials {
username findProperty("mavenUsername")?.toString() ?: ""
password findProperty("mavenPassword")?.toString() ?: ""
}
allowInsecureProtocol = true
url SNAPSHOT_URL
}
}
dependencyManagement {
imports {
mavenBom "com.xu3au.cloud:xu3au-dependencies:${xxf_version}"
}
resolutionStrategy { cacheChangingModulesFor 0, 'seconds' }
}
dependencies {
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
annotationProcessor("org.projectlombok:lombok")
compileOnly("org.projectlombok:lombok")
testImplementation("org.projectlombok:lombok")
}
// 全局禁用包
/*configurations {
all*.exclude group: "org.springframework.boot", module: "spring-boot-starter-logging"
}*/
configurations.configureEach {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
publishing {
publications {
maven(MavenPublication) {
from components.java
// 设置默认的 artifact ID 为项目名称
artifactId = "${project.name}"
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
}
}
repositories {
maven {
url = version.toString().endsWith('SNAPSHOT') ? SNAPSHOT_URL : RELEASE_URL
allowInsecureProtocol = true
credentials {
username findProperty("mavenUsername")?.toString() ?: ""
password findProperty("mavenPassword")?.toString() ?: ""
}
}
}
}