-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.gradle
185 lines (147 loc) · 4.62 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
import java.nio.charset.StandardCharsets
plugins {
// IDE
id 'idea'
// Language
id 'java'
id 'java-library'
// Core frameworks
id 'org.springframework.boot' version '3.4.1'
id 'io.spring.dependency-management' version '1.1.7'
// Publishing
id 'com.vanniktech.maven.publish' version '0.30.0'
// Utility
id 'jacoco'
id 'org.sonarqube' version '6.0.1.5171'
id 'com.diffplug.spotless' version '7.0.2'
}
// Project properties
group = "$GROUP"
version = "$VERSION_NAME"
description = "$POM_DESCRIPTION"
// Source code properties
java {
def version = JavaVersion.VERSION_17.toString()
sourceCompatibility = version
targetCompatibility = version
toolchain {
languageVersion = JavaLanguageVersion.of(version)
}
}
repositories {
mavenCentral()
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
dependencyManagement {
imports {
// https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-dependencies
mavenBom 'org.springframework.cloud:spring-cloud-dependencies:2024.0.0'
}
}
dependencies {
implementation('org.springframework.boot:spring-boot-starter-cache') {
exclude group: 'ch.qos.logback', module: 'logback-core'
exclude group: 'ch.qos.logback', module: 'logback-classic'
}
implementation('org.springframework.boot:spring-boot-starter-data-redis') {
exclude group: 'ch.qos.logback', module: 'logback-core'
exclude group: 'ch.qos.logback', module: 'logback-classic'
}
implementation('org.springframework.boot:spring-boot-actuator') {
exclude group: 'ch.qos.logback', module: 'logback-core'
exclude group: 'ch.qos.logback', module: 'logback-classic'
}
// Vulnerability found:
// https://ossindex.sonatype.org/vulnerability/CVE-2024-12801?component-type=maven&component-name=ch.qos.logback%2Flogback-core&utm_source=ossindex-client&utm_medium=integration&utm_content=1.7.0
// https://ossindex.sonatype.org/vulnerability/CVE-2024-12798?component-type=maven&component-name=ch.qos.logback%2Flogback-core&utm_source=ossindex-client&utm_medium=integration&utm_content=1.7.0
// https://mvnrepository.com/artifact/ch.qos.logback/logback-core
implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.5.16'
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.5.16'
implementation 'io.micrometer:micrometer-core'
implementation 'com.github.ben-manes.caffeine:caffeine'
implementation 'io.github.resilience4j:resilience4j-circuitbreaker'
// For exception handling utilities
// https://mvnrepository.com/artifact/io.github.suppierk/java-throwable-utils
implementation 'io.github.suppierk:java-throwable-utils:2.0.0'
compileOnly 'org.projectlombok:lombok'
annotationProcessor('org.springframework.boot:spring-boot-configuration-processor') {
exclude group: 'ch.qos.logback', module: 'logback-core'
exclude group: 'ch.qos.logback', module: 'logback-classic'
}
annotationProcessor 'org.projectlombok:lombok'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'ch.qos.logback', module: 'logback-core'
exclude group: 'ch.qos.logback', module: 'logback-classic'
}
testImplementation 'org.awaitility:awaitility'
testImplementation 'org.testcontainers:junit-jupiter'
}
test {
useJUnitPlatform()
}
// Enable Spotless code formatting rules
spotless {
java {
target '**/src/*/java/**/*.java'
// Aligns with Intellij IDEA default settings
toggleOffOn('@formatter:off', '@formatter:on')
googleJavaFormat()
}
groovyGradle {
target '**/*.gradle'
greclipse()
}
}
// Swap build tasks to build library only
bootJar {
enabled = false
}
jar {
enabled = true
archiveClassifier.set('')
}
task sourceJar(type: Jar, dependsOn: classes) {
archiveClassifier.set('sources')
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}
artifacts {
archives jar
archives javadocJar
archives sourceJar
}
// Configure several tasks additionally for Gradle
tasks.withType(Copy).configureEach {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
tasks.withType(JavaCompile).configureEach {
options.encoding = StandardCharsets.UTF_8.name()
dependsOn(spotlessJavaCheck)
}
test {
// Report is always generated after tests run
finalizedBy jacocoTestReport
}
jacocoTestReport {
// Tests are required to run before generating the report
dependsOn test
reports {
html.required = true
xml.required = true
csv.required = false
}
}
sonar {
properties {
property "sonar.projectKey", "SuppieRK_spring-boot-multilevel-cache-starter"
property "sonar.organization", "suppierk"
property "sonar.host.url", "https://sonarcloud.io"
}
}