-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
172 lines (152 loc) · 4.63 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
plugins {
id 'org.springframework.boot' version '3.3.0'
id 'io.spring.dependency-management' version '1.1.5'
id "io.freefair.lombok" version "8.6"
id 'maven-publish'
id 'signing'
id 'java-library'
id 'application'
id 'idea'
}
group = 'com.houkunlin'
version = '1.2.10'
def gitRepo = "github.com/houkunlin-starter/system-common-starter.git"
def isSnapshot = findProperty("snapshot") != null || version.endsWith('SNAPSHOT')
if (isSnapshot && !version.endsWith('SNAPSHOT')) {
version += '-BUILD-SNAPSHOT'
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenLocal()
mavenCentral()
// Spring 里程碑仓库
maven { url 'https://repo.spring.io/artifactory/libs-milestone/' }
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'com.fasterxml.jackson.datatype:jackson-datatype-joda'
testCompileOnly 'com.fasterxml.jackson.datatype:jackson-datatype-joda'
compileOnly 'org.springframework.boot:spring-boot-starter-security'
api 'org.apache.commons:commons-lang3:3.12.0'
annotationProcessor 'org.projectlombok:lombok-mapstruct-binding:0.2.0'
testAnnotationProcessor 'org.projectlombok:lombok-mapstruct-binding:0.2.0'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
publishing {
publications {
library(MavenPublication) {
from components.java
pom {
name = project.name
packaging = 'jar'
description = project.name
url = "https://${gitRepo}"
// properties = []
licenses {
license {
name = 'Mulan Permissive Software License,Version 2'
url = 'https://license.coscl.org.cn/MulanPSL2'
}
}
developers {
developer {
id = 'houkunlin'
name = 'HouKunLin'
email = '[email protected]'
}
}
scm {
connection = "scm:git://${gitRepo}"
developerConnection = "scm:git://${gitRepo}"
url = "git://${gitRepo}"
}
}
}
}
repositories {
maven {
name = "sonatype"
credentials {
username = findProperty("ossrhUsername") ?: System.getenv("ossrhUsername")
password = findProperty("ossrhPassword") ?: System.getenv("ossrhPassword")
}
// 正式环境
def releasesRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
// 非正式环境库
def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
url isSnapshot ? snapshotsRepoUrl : releasesRepoUrl
}
maven {
name = "buildDir"
String releasesRepoUrl = "$buildDir/repos/releases"
String snapshotsRepoUrl = "$buildDir/repos/snapshots"
url isSnapshot ? snapshotsRepoUrl : releasesRepoUrl
}
}
}
signing {
// 使用 gradle.properties 设置参数,或者在命令行中增加 -Pgpg_private_key= -Pgpg_password= 设置参数
// 或者在环境变量中设置相应的环境变量
String signingKey = findProperty("gpg_private_key") ?: System.getenv("gpg_private_key")
if (signingKey != null) {
String signingPassword = findProperty("gpg_password") ?: System.getenv("gpg_password")
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications
// sign configurations.archives
}
bootJar {
enabled = false
}
bootStartScripts {
enabled = false
}
bootDistTar {
enabled = false
}
bootDistZip {
enabled = false
}
startScripts {
enabled = false
}
distTar {
enabled = false
}
distZip {
enabled = false
}
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
jar {
enabled = true
setArchiveClassifier("")
}
java {
withJavadocJar()
withSourcesJar()
}
javadoc {
enabled = true
options.encoding = "UTF-8"
options.addStringOption('Xdoclint:none', '-quiet')
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
compileJava {
options.encoding = "UTF-8"
}
test {
useJUnitPlatform()
}