forked from guoshiqiufeng/spring-cloud-stream-redis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
220 lines (190 loc) · 7.32 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
import java.time.LocalDateTime
allprojects {
group APP_GROUP
version APP_VERSION
}
apply from: 'ext.gradle'
description = "spring cloud stream redis"
subprojects {
apply plugin: 'java-library'
apply plugin: 'signing'
apply plugin: 'maven-publish'
apply plugin: "io.freefair.lombok"
apply plugin: 'com.github.hierynomus.license'
apply plugin: "io.spring.dependency-management"
sourceCompatibility = "${javaVersion}"
targetCompatibility = "${javaVersion}"
lombok {
version = "1.18.30"
}
compileJava {
options.release = 17
}
compileTestJava {
options.release = 17
}
repositories {
mavenLocal()
maven { url "https://maven.aliyun.com/repository/public" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
mavenCentral()
}
def onlyPom = project.name == "spring-cloud-starter-parent" || project.name == "spring-cloud-stream-dependencies"
if (!onlyPom) {
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:${springBoot3Version}"
mavenBom "org.springframework.cloud:spring-cloud-stream-dependencies:${springCloudStreamVersion}"
}
dependencies {
}
}
}
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://guoshiqiufeng.github.io/spring-cloud-stream-redis'
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("-", ".")}"
}
}
}
license {
encoding = "UTF-8"
header = rootProject.file("header.txt")
includes(["**/*.java", "**/*.kt"])
mapping {
java = "SLASHSTAR_STYLE"
kt = "SLASHSTAR_STYLE"
}
ignoreFailures = true
ext.year = Calendar.getInstance().get(Calendar.YEAR)
}
task sourcesJar(type: Jar) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
javadoc {
// Check for syntax during linting. 'none' doesn't seem to work in suppressing
// all linting warnings all the time (see/link references most notably).
options.addStringOption("Xdoclint:syntax", "-quiet")
// Suppress warnings due to cross-module @see and @link references.
// Note that global 'api' task does display all warnings, and
// checks for 'reference' on top of 'syntax'.
logging.captureStandardError LogLevel.INFO
logging.captureStandardOutput LogLevel.INFO // suppress "## warnings" message
afterEvaluate {
configure(options) {
encoding "UTF-8"
charSet 'UTF-8'
author true
version true
failOnError false
links "https://docs.oracle.com/javase/8/docs/api"
}
}
}
test {
dependsOn("cleanTest", "generatePomFileForMavenJavaPublication")
useJUnitPlatform()
}
task javadocJar(type: Jar) {
archiveClassifier = 'javadoc'
from javadoc
}
tasks.whenTaskAdded { task ->
if (task.name.contains('signMavenJavaPublication') && project.hasProperty('signing.secretKeyRingFile')) {
task.enabled = new File(project.property('signing.secretKeyRingFile') as String).isFile()
}
}
publishing {
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
if (project.hasProperty('storedUsername') && project.hasProperty('storedPassword')) {
username project.storedUsername
password project.storedPassword
}
}
}
}
publications {
mavenJava(MavenPublication) {
if (!onlyPom) {
from components.java
artifact sourcesJar
artifact javadocJar
}
pom {
name = artifactId
description = 'spring cloud stream redis realization'
if (onlyPom) {
packaging 'pom'
} else {
packaging 'jar'
}
// description = 'spring cloud stream redis .'
url = 'https://github.com/guoshiqiufeng/spring-cloud-stream-redis'
scm {
connection = 'scm:git@github.com:guoshiqiufeng/spring-cloud-stream-redis.git'
developerConnection = 'scm:git@github.com:guoshiqiufeng/spring-cloud-stream-redis.git'
url = 'https://github.com/guoshiqiufeng/spring-cloud-stream-redis'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'fubluesky'
name = 'yanghq'
email = 'fubluesky@foxmail.com'
}
}
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
}
}
}