-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
121 lines (100 loc) · 3.9 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
121 lines (100 loc) · 3.9 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
import de.thetaphi.forbiddenapis.gradle.CheckForbiddenApis
plugins {
java
idea
checkstyle
id("org.springframework.boot") version "3.3.1"
id("io.spring.dependency-management") version "1.1.5"
id("io.freefair.lombok") version "8.6"
id("org.cyclonedx.bom") version "1.10.0"
id("de.thetaphi.forbiddenapis") version "3.7"
}
group = "com.colin-moerbe"
// Exposed additional information about the application to the /info actuator endpoint.
springBoot {
buildInfo()
}
java {
sourceCompatibility = JavaVersion.VERSION_21 // Gradle should use Java 21 features and Syntax when compiling
toolchain {
// Gradle checks for a local Java 21 version and uses it if one is found.
// If there's no local version, the build crashes. The foojay-resolver-convention plugin is needed then.
languageVersion.set(JavaLanguageVersion.of(21))
vendor = JvmVendorSpec.ADOPTIUM // Gradle uses Eclipse Temurin (AdoptOpenJDK HotSpot)
}
}
repositories {
mavenCentral()
}
dependencyManagement {
imports {
mavenBom ("org.springframework.boot:spring-boot-dependencies:3.3.1")
}
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-docker-compose")
implementation("org.springframework.boot:spring-boot-testcontainers")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.slf4j:slf4j-api")
implementation("org.postgresql:postgresql")
implementation("org.apache.httpcomponents.client5:httpclient5") // Necessary so that PATCH requests work
developmentOnly("org.springframework.boot:spring-boot-devtools") // Ctrl+F9 for recompiling, this fast restarts the server
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.boot:spring-boot-testcontainers")
testImplementation("org.testcontainers:junit-jupiter:")
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.assertj:assertj-core:")
testImplementation("org.testcontainers:postgresql")
}
// Loads the versioning logic, and the custom Gradle tasks
apply(from = "versioning.gradle.kts")
tasks.withType<Test> {
useJUnitPlatform()
}
// TODO: Make sure this works. Perhaps another version has to be used, as the version is written in the version.properties file
tasks.withType<Jar> {
manifest {
attributes["Implementation-Version"] = version
}
}
tasks.named<DefaultTask>("checkstyleMain").configure {
isEnabled = true
}
tasks.named<DefaultTask>("checkstyleTest").configure {
isEnabled = true
}
tasks.named<CheckForbiddenApis>("forbiddenApisMain").configure {
bundledSignatures = setOf("jdk-unsafe", "jdk-deprecated", "jdk-internal", "jdk-non-portable", "jdk-system-out", "jdk-reflection")
signaturesFiles = project.files("forbidden-apis.txt")
isEnabled = true
}
tasks.named<CheckForbiddenApis>("forbiddenApisTest").configure {
bundledSignatures = setOf("jdk-unsafe", "jdk-deprecated", "jdk-internal", "jdk-non-portable", "jdk-reflection")
signaturesFiles = project.files("forbidden-apis.txt")
isEnabled = true
}
tasks.named("check").configure {
dependsOn(tasks.named("forbiddenApisMain"))
}
tasks.cyclonedxBom {
setIncludeConfigs(listOf("runtimeClasspath"))
setSkipConfigs(listOf("compileClasspath", "testCompileClasspath"))
setProjectType("application")
setDestination(project.file("build/reports"))
setOutputName("bom")
setOutputFormat("json")
}
idea {
module {
isDownloadJavadoc = true
isDownloadSources = true
}
}
checkstyle {
configFile = project.file("checkstyle.xml")
toolVersion = "10.17.0"
}