-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
166 lines (146 loc) · 6.06 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
// Customize the Gradle Wrapper generation task.
wrapper {
gradleVersion = "8.4"
// Use "-all"-version of distribution, since IntelliJ works better then..
setDistributionType(Wrapper.DistributionType.ALL)
}
allprojects {
group = 'io.mats3.matsbrokermonitor'
version = '1.0.13-2024-06-17'
layout.buildDirectory = new File("build-gradle")
}
// Versions for all libraries used throughout the subprojects
ext {
matsVersion = '0.19.19-2024-04-30'
slf4jVersion = '2.0.12' // Only CompileOnly
jmsApiDependency = 'jakarta.jms:jakarta.jms-api:2.0.3' // Following Mats3's lead. Only CompileOnly.
jacksonVersion = '2.17.0'
stbHealthCheckVersion = '0.4.0+2023-04-25' // For 'matsbrokermonitor-stb-healthcheck'
// === For testing
activeMqVersion = '5.18.4'
artemisMqVersion = '2.33.0'
springVersion = '5.3.34' // Spring 6 depends on Java 17 and Jakarta EE 9+
junitVersion = '4.13.2'
logbackVersion = '1.5.5'
jettyVersion = '9.4.54.v20240208'
}
subprojects {
apply plugin: "java-library"
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
withJavadocJar()
withSourcesJar()
}
repositories { mavenCentral() }
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.incremental = true
options.compilerArgs += ['-Werror', '-Xlint:all', '-Xlint:-serial']
}
javadoc {
// without the -quiet option, the build fails due to errors&warns
options.addStringOption('Xdoclint:none', '-quiet')
}
jar {
manifest {
attributes 'Implementation-Title': 'MatsBrokerMonitor',
'Implementation-Version': archiveVersion
}
}
test {
/*
* It is possible to change the broker to which tests are run. Check mats3/build.gradle for more doc.
*
* An example:
*
* == Run all tests against an external Artemis MQ broker on localhost:
* ./gradlew -Pmats.test.broker=artemis -Pmats.test.brokerurl=localhost clean test
*/
systemProperties project.properties.subMap(["mats.test.brokerurl", "mats.test.broker"])
}
// ------------------------------------------------
// -- Simple tools
// Define dependency report task that all subprojects gets. Invoke with "./gradlew allDeps | less"
tasks.register('allDeps', DependencyReportTask) {}
// Some info about current gradle environment.
tasks.register('systemInformation') {
doLast {
println "\n** Java properties [System.getProperties()], sorted:\n"
System.properties.sort().each { k, v ->
println("$k = $v")
}
println "\n** Environment [System.getenv()], sorted:\n"
System.env.sort().each { k, v ->
println("$k = $v")
}
println ''
println "** Java Version: " + System.getProperty("java.version")
println "** Groovy Version: " + GroovySystem.getVersion()
println "** Gradle Version: " + gradle.gradleVersion
}
}
}
// For publishing subprojects: All, minus 'matsbrokermonitor-app'
configure(subprojects.findAll { it.name != 'matsbrokermonitor-app' }) {
apply plugin: 'signing'
apply plugin: 'maven-publish'
signing {
// Sign everything, even MD5s and SHAs..
sign publishing.publications
}
publishing {
publications {
mavenJava(MavenPublication) {
pom {
name = 'Mats Broker Monitor'
description = 'Monitoring solution for the backend message broker of Mats'
url = 'https://github.com/centiservice/matsbrokermonitor'
licenses {
license {
name = 'PolyForm Perimeter License 1.0.0 with examples'
url = 'https://github.com/centiservice/matsbrokermonitor/blob/main/LICENSE.md'
}
}
developers {
developer {
id = 'stolsvik'
name = 'Endre Stølsvik'
email = 'endre@stolsvik.com'
}
}
scm {
connection = 'scm:git:https://github.com/centiservice/matsbrokermonitor.git'
developerConnection = 'scm:git:ssh://github.com:centiservice/matsbrokermonitor.git'
url = 'https://github.com/centiservice/matsbrokermonitor'
}
}
from components.java
}
}
repositories {
maven {
name 'SonatypeOSSRHSnapshot'
url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
credentials {
// using findProperty(..) to be able to build without it being defined.
username findProperty('sonatypeUsername') as String ?: "should be in different file"
password findProperty('sonatypePassword') as String ?: "should be in different file"
}
}
maven {
name 'SonatypeOSSRHStaging'
url 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2'
credentials {
// using findProperty(..) to be able to build without it being defined.
username findProperty('sonatypeUsername') as String ?: "should be in different file"
password findProperty('sonatypePassword') as String ?: "should be in different file"
}
}
}
}
// Tasks to publish to Sonatype's OSSRH (OSS Repository Hosting), Snapshot and Staging
tasks.register('matsPublishSnapshot') { dependsOn publishAllPublicationsToSonatypeOSSRHSnapshotRepository }
tasks.register('matsPublishStaging') { dependsOn publishAllPublicationsToSonatypeOSSRHStagingRepository }
}