-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.gradle
171 lines (143 loc) · 4.64 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
import com.github.spotbugs.snom.Confidence
import com.github.spotbugs.snom.Effort
import com.github.spotbugs.snom.SpotBugsTask
plugins {
id 'java'
id 'org.springframework.boot' version '3.4.2'
id 'io.spring.dependency-management' version '1.1.7'
id 'jacoco'
id 'checkstyle'
id 'com.github.spotbugs' version '6.1.3'
id 'com.palantir.git-version' version '3.1.0'
id 'pmd'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
repositories {
mavenCentral()
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
ext {
set('springCloudVersion', "2024.0.0")
set('mapstructVersion', "1.6.3")
set('springdocOpenApiVersion', "2.7.0")
set('springHateoasVersion', "2.4.1")
set('commonsLang3Version', "3.17.0")
set('lombokVersion', "1.18.36")
set('postgresqlVersion', "42.7.4")
set('h2Version', "2.3.232")
set('spotbugsVersion', '4.8.6')
set('micrometerVersion', '1.4.1')
set('flywayPostgresVersion', '11.1.0')
}
dependencies {
// Spring Boot
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
// Spring Cloud
implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap'
implementation 'org.springframework.cloud:spring-cloud-config-client'
implementation 'org.springframework.cloud:spring-cloud-starter'
// Others
implementation "org.mapstruct:mapstruct:${mapstructVersion}"
implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:${springdocOpenApiVersion}"
implementation "org.springframework.hateoas:spring-hateoas:${springHateoasVersion}"
implementation "io.micrometer:micrometer-tracing-bridge-brave:${micrometerVersion}"
implementation 'org.flywaydb:flyway-core'
compileOnly "org.projectlombok:lombok:${lombokVersion}"
compileOnly "com.github.spotbugs:spotbugs-annotations:${spotbugsVersion}"
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
annotationProcessor "org.mapstruct:mapstruct-processor:${mapstructVersion}"
developmentOnly 'org.springframework.boot:spring-boot-docker-compose'
runtimeOnly "org.flywaydb:flyway-database-postgresql:${flywayPostgresVersion}"
runtimeOnly "org.postgresql:postgresql:${postgresqlVersion}"
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation "org.projectlombok:lombok:${lombokVersion}"
testImplementation "com.h2database:h2:${h2Version}"
testImplementation "org.apache.commons:commons-lang3:${commonsLang3Version}"
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
bootJar {
archiveFileName = 'app.jar'
}
jar {
enabled = false
}
def details = versionDetails()
springBoot {
buildInfo {
properties {
group = "com.buddy.api"
version = details.lastTag ?: "0.0.0"
additional = ['developers': 'hywenklis.']
}
}
}
tasks.named('test') {
useJUnitPlatform()
finalizedBy("jacocoTestReport")
}
tasks.jacocoTestReport {
reports {
xml.required = true
csv.required = true
html.required = true
}
}
checkstyle {
toolVersion = '10.17.0'
configFile = file("${rootProject.projectDir}/config/checkstyle/checkstyle.xml")
maxWarnings = 0
showViolations = true
ignoreFailures = false
}
tasks.withType(Checkstyle).configureEach {
reports {
xml.required = false
html.required = true
html.stylesheet resources.text.fromFile('config/checkstyle/xsl/checkstyle-custom.xsl')
}
}
checkstyleMain.dependsOn compileJava
checkstyleTest.dependsOn compileTestJava
tasks.withType(SpotBugsTask).configureEach {
reports {
xml.required = false
html.required = true
}
}
tasks.withType(JavaCompile).configureEach {
options.compilerArgs.addAll([
"-parameters",
"-Amapstruct.defaultComponentModel=spring",
"-Amapstruct.unmappedTargetPolicy=IGNORE"
])
}
spotbugs {
ignoreFailures = false
showStackTraces = true
showProgress = true
effort = Effort.MAX
reportLevel = Confidence.valueOf('HIGH')
excludeFilter = file('config/spotbugs/spotbugs-exclude.xml')
}
pmd {
toolVersion = "7.0.0"
ignoreFailures = false
consoleOutput = true
}