-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
361 lines (285 loc) · 14 KB
/
Copy pathbuild.gradle
File metadata and controls
361 lines (285 loc) · 14 KB
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
import com.gorylenko.GenerateGitPropertiesTask
// This section is required so that the latest version of the liquibase gradle plugin works
buildscript {
dependencies {
classpath("org.liquibase:liquibase-core:${liquibaseVersion}") {
exclude group: "com.opencsv", module: "opencsv"
}
}
}
plugins {
id "checkstyle"
id "idea"
id "java"
id "jacoco"
id "com.diffplug.spotless" version "${spotlessPluginVersion}"
id "com.github.andygoossens.gradle-modernizer-plugin" version "${modernizerPluginVersion}"
id "com.github.ben-manes.versions" version "0.54.0"
id "com.github.node-gradle.node" version "${gradleNodePluginVersion}"
id "com.google.cloud.tools.jib" version "${jibPluginVersion}"
id "com.gorylenko.gradle-git-properties" version "${gitPropertiesPluginVersion}"
id "io.spring.dependency-management" version "1.1.7"
id "org.liquibase.gradle" version "${liquibasePluginVersion}"
id "org.openapi.generator" version "${openapiPluginVersion}"
id "org.sonarqube" version "${sonarqubePluginVersion}"
id "org.springframework.boot" version "${springBootVersion}"
}
group = "de.tum.cit.aet"
version = "0.4.3"
description = "Benchmarking Application for Performance Tests in the Artemis project"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(25)
}
}
ext {
springProfiles = ""
}
apply from: "gradle/docker.gradle"
apply from: "gradle/sonar.gradle"
spotless {
java {
target "src/*/java/**/*.java"
// removeUnusedImports()
}
}
apply from: "gradle/cache.gradle"
apply from: "gradle/liquibase.gradle"
if (project.hasProperty("prod")) {
apply from: "gradle/profile_prod.gradle"
} else {
apply from: "gradle/profile_dev.gradle"
}
if (project.hasProperty("war")) {
apply from: "gradle/war.gradle"
}
idea {
module {
excludeDirs += files("node_modules")
}
}
defaultTasks "bootRun"
springBoot {
mainClass = "de.tum.cit.aet.ArtemisBenchmarkingApp"
}
modernizer {
failOnViolations = true
includeTestClasses = true
}
tasks.register("testReport", TestReport) {
destinationDirectory.set(layout.buildDirectory.dir("reports/tests"))
testResults.from(tasks.named("test"))
}
tasks.withType(GenerateGitPropertiesTask).configureEach {
outputs.doNotCacheIf("Task is always executed") { true }
}
checkstyle {
// Exclude everything under the build directory
toolVersion = "${checkstyleVersion}"
configFile = file("checkstyle.xml")
checkstyleTest.enabled = false
maxErrors = 0
}
checkstyleMain.source = "src/main/java"
configurations {
providedRuntime
mockitoAgent
}
repositories {
mavenCentral()
mavenLocal()
}
configurations.configureEach {
exclude group: "org.dom4j", module: "dom4j"
exclude group: "org.xmlpull", module: "pull-parser"
exclude group: "jaxen", module: "jaxen"
exclude group: "xmlpull", module: "xpp3"
exclude group: "xsdlib", module: "xsdlib"
exclude group: "javax.xml.stream", module: "stax-api"
exclude group: "com.vaadin.external.google", module: "android-json"
exclude group: "org.xmlunit", module: "xmlunit-core"
exclude group: "org.testcontainers", module: "mariadb"
exclude group: "org.testcontainers", module: "mssqlserver"
exclude group: "jakarta.ws.rs", module: "jsr311-api"
exclude group: "org.springframework.boot", module: "spring-boot-starter-undertow"
// these modules include security issues and are not needed
exclude group: "commons-jxpath", module: "commons-jxpath"
exclude group: "com.fasterxml.woodstox", module: "woodstox-core"
// those are transitive dependencies of JPlag Text --> Stanford NLP
// Note: we exclude them because they are not needed and might have security vulnerabilities
exclude group: "org.apache.lucene", module: "lucene-queryparser"
exclude group: "org.apache.lucene", module: "lucene-core"
exclude group: "org.apache.lucene", module: "lucene-analyzers-common"
exclude group: "org.jasypt", module: "jasypt"
// required by eureka client, but not used in this project
exclude group: "com.thoughtworks.xstream", module: "xstream"
// required by JPlag, but not used in this project
exclude group: "xerces", module: "xercesImpl"
// required by JPlag, but not used in this project
exclude group: "xalan", module: "xalan"
// required by JPlag, but not used in this project
exclude group: "xalan", module: "serializer"
exclude group: "org.springframework.boot", module: "spring-boot-starter-cache"
exclude group: "net.logstash.logback", module: "logstash-logback-encoder"
exclude group: "javax.cache", module: "cache-api"
exclude group: "javax.transaction", module: "javax.transaction-api"
// JPlag depends on those, but they are not really needed
exclude group: "org.jgrapht", module: "jgrapht-core"
exclude group: "org.apfloat", module: "apfloat"
exclude group: "xom", module: "xom"
exclude group: "commons-configuration", module: "commons-configuration"
}
dependencies {
annotationProcessor "org.mapstruct:mapstruct-processor:${mapstructVersion}"
annotationProcessor "org.glassfish.jaxb:jaxb-runtime:${jaxbRuntimeVersion}"
implementation "org.springdoc:springdoc-openapi-starter-webmvc-api:3.0.3"
implementation "org.apache.commons:commons-lang3:${commonsLangVersion}"
implementation "org.openapitools:jackson-databind-nullable:${jacksonDatabindNullableVersion}"
implementation "jakarta.ws.rs:jakarta.ws.rs-api:4.0.0"
implementation "javax.annotation:javax.annotation-api:1.3.2"
implementation "javax.validation:validation-api:2.0.1.Final"
implementation "org.hibernate.orm:hibernate-core"
implementation "org.mapstruct:mapstruct:${mapstructVersion}"
implementation "org.springframework.boot:spring-boot-starter-actuator"
implementation "org.springframework.boot:spring-boot-starter-cache"
implementation "org.springframework.boot:spring-boot-starter-webflux"
implementation "org.springframework.boot:spring-boot-starter-data-jpa"
implementation "org.springframework.boot:spring-boot-starter-liquibase"
implementation "org.springframework.boot:spring-boot-starter-logging"
implementation "org.springframework.boot:spring-boot-starter-mail"
implementation "org.springframework.boot:spring-boot-starter-security"
implementation "org.springframework.boot:spring-boot-starter-thymeleaf"
implementation("net.minidev:json-smart") { version { strictly "2.6.0" } }
// use newest version of commons-compress to avoid security issues through outdated dependencies
implementation "org.apache.commons:commons-compress:1.28.0"
implementation "org.springframework.boot:spring-boot-starter-web"
implementation "org.springframework.boot:spring-boot-starter-websocket"
implementation "org.springframework.boot:spring-boot-starter-oauth2-resource-server"
implementation "org.springframework.security:spring-security-data"
// use newest version of nimbus-jose-jwt to avoid security issues through outdated dependencies
implementation "com.nimbusds:nimbus-jose-jwt:10.9.1"
implementation "io.micrometer:micrometer-registry-prometheus"
// Prometheus requires the protobuf-java dependency, but we explicitly use the latest version to avoid security vulnerabilities
implementation "com.google.protobuf:protobuf-java:4.35.1"
implementation "io.dropwizard.metrics:metrics-core:4.2.39"
implementation "org.springframework.security:spring-security-messaging"
implementation "commons-io:commons-io:2.22.0"
implementation "com.thedeanda:lorem:2.2"
implementation "org.eclipse.jgit:org.eclipse.jgit:${jgitVersion}"
// https://search.maven.org/artifact/org.eclipse.jgit/org.eclipse.jgit
implementation "org.eclipse.jgit:org.eclipse.jgit.ssh.apache:${jgitVersion}"
// Note: jgit.htt.server is not compatible with jakarta yet and neither is there a timeline. Hence, we had to add the source files to our repository.
// Once the compatibility is given, we can switch back to the maven dependency.
implementation "org.eclipse.jgit:org.eclipse.jgit.http.server:${jgitVersion}"
// apache ssh enabled the ssh git operations in LocalVC together with JGit
implementation "org.apache.sshd:sshd-core:${sshdVersion}"
implementation "org.apache.sshd:sshd-git:${sshdVersion}"
implementation "org.apache.sshd:sshd-osgi:${sshdVersion}"
implementation "org.apache.sshd:sshd-sftp:${sshdVersion}"
implementation "org.bouncycastle:bcpkix-jdk18on:1.84"
implementation "org.bouncycastle:bcprov-jdk18on:1.84"
implementation "io.projectreactor.netty:reactor-netty-core"
implementation "io.projectreactor.netty:reactor-netty-http"
implementation "io.reactivex.rxjava3:rxjava:3.1.12"
// TODO: we should remove this dependency once we have migrated to org.apache.commons:csv
implementation ("com.opencsv:opencsv:5.12.0") {
exclude group: "org.junit.vintage", module: "junit-vintage-engine"
}
// explicitly only use this at runtime (required by liquibase, because developers should prefer org.apache.commons:csv
runtimeOnly ("com.opencsv:opencsv:5.12.0") {
exclude group: "org.junit.vintage", module: "junit-vintage-engine"
}
// ---- CHECKSTYLE DEPENDENCIES ----
// use newest version of plexus to avoid security issues through outdated dependencies
checkstyle "org.codehaus.plexus:plexus-container-default:2.1.1"
checkstyle "org.codehaus.plexus:plexus-classworlds:2.12.0"
checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
checkstyle "org.apache.commons:commons-lang3:${commonsLangVersion}"
// ---- TEST DEPENDENCIES ----
testImplementation "org.testcontainers:testcontainers-jdbc:${testcontainersVersion}"
testImplementation "org.testcontainers:testcontainers-junit-jupiter:${testcontainersVersion}"
testImplementation "org.testcontainers:testcontainers:${testcontainersVersion}"
testImplementation "org.springframework.boot:spring-boot-starter-test"
testImplementation "org.springframework.boot:spring-boot-test"
testImplementation "org.springframework.boot:spring-boot-webmvc-test"
testImplementation "org.springframework.security:spring-security-test"
testImplementation("com.tngtech.archunit:archunit-junit5-api:${archunitJunit5Version}") {
exclude group: "org.slf4j", module: "slf4j-api"
}
testRuntimeOnly("com.tngtech.archunit:archunit-junit5-engine:${archunitJunit5Version}") {
exclude group: "org.slf4j", module: "slf4j-api"
}
testImplementation "org.junit.jupiter:junit-jupiter:${junitVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
// Required for Testcontainers to work with JUnit 5
testImplementation "org.junit.vintage:junit-vintage-engine:${junitVersion}"
// NOTE: make sure this corresponds to the version used for JUnit in the testImplementation
testImplementation "org.junit.platform:junit-platform-commons:${junitVersion}"
testImplementation "org.junit.platform:junit-platform-engine:${junitVersion}"
testRuntimeOnly "org.junit.platform:junit-platform-launcher:${junitVersion}"
def mockitoAgentVersion = dependencyManagement.importedProperties["mockito.version"] ?: "5.20.0"
mockitoAgent("org.mockito:mockito-core:${mockitoAgentVersion}") {
transitive = false
}
}
// we have to apply the test.gradle file after the dependencies block, otherwise we get the error Cannot change dependencies of dependency configuration ":mockitoAgent" after it has been resolved
apply from: "gradle/test.gradle"
tasks.register("cleanResources", Delete) {
delete(layout.buildDirectory.dir("resources"))
}
wrapper {
gradleVersion = "9.6.0"
}
tasks.register("webapp_test", PnpmTask) {
inputs.property("appVersion", project.version)
inputs.files("pnpm-lock.yaml")
.withPropertyName("pnpm-lock")
.withPathSensitivity(PathSensitivity.RELATIVE)
inputs.files("build.gradle")
.withPropertyName("build.gradle")
.withPathSensitivity(PathSensitivity.RELATIVE)
inputs.files("angular.json")
.withPropertyName("angular.json")
.withPathSensitivity(PathSensitivity.RELATIVE)
inputs.files("tsconfig.json", "tsconfig.app.json")
.withPropertyName("tsconfig")
.withPathSensitivity(PathSensitivity.RELATIVE)
inputs.dir("src/main/webapp/")
.withPropertyName("webapp-source-dir")
.withPathSensitivity(PathSensitivity.RELATIVE)
outputs.file("build/test-results/clover.xml")
.withPropertyName("clover-result")
dependsOn(tasks.named("pnpmInstall"), tasks.named("compileTestJava"))
args = ["run", "test"]
}
node {
download = true
version = "${node_version}"
pnpmVersion = "${pnpm_version}"
}
compileJava.dependsOn processResources
processResources.dependsOn bootBuildInfo
def isNonStable = { String version ->
def stableKeyword = ["RELEASE", "FINAL", "GA"].any { it -> version.toUpperCase().contains(it) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}
tasks.named("dependencyUpdates").configure {
rejectVersionIf {
isNonStable(it.candidate.version)
}
rejectVersionIf {
isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)
}
}
// Available commands:
//
// 1) Build production: ./gradlew -Pprod -Pwar clean bootWar
// 2) Execute server integration tests: ./gradlew test -x webapp
// 3) Find dependency updates: ./gradlew dependencyUpdates -Drevision=release
// 4) Check Java code format: ./gradlew spotlessCheck -x webapp
// 5) Apply Java code formatter: ./gradlew spotlessApply -x webapp
// 6) Check JavaDoc: ./gradlew checkstyleMain -x webapp
// 7) Detects uses of legacy code: ./gradlew modernizer -x webapp