forked from Loopers-dev-lab/loop-pack-be-l2-vol2-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
111 lines (98 loc) · 3.62 KB
/
build.gradle.kts
File metadata and controls
111 lines (98 loc) · 3.62 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
import org.gradle.api.Project.DEFAULT_VERSION
import org.springframework.boot.gradle.tasks.bundling.BootJar
/** --- configuration functions --- */
fun getGitHash(): String {
return runCatching {
providers.exec {
commandLine("git", "rev-parse", "--short", "HEAD")
}.standardOutput.asText.get().trim()
}.getOrElse { "init" }
}
/** --- project configurations --- */
plugins {
java
id("org.springframework.boot") apply false
id("io.spring.dependency-management")
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
allprojects {
val projectGroup: String by project
group = projectGroup
version = if (version == DEFAULT_VERSION) getGitHash() else version
repositories {
mavenCentral()
}
}
subprojects {
apply(plugin = "java")
apply(plugin = "org.springframework.boot")
apply(plugin = "io.spring.dependency-management")
apply(plugin = "jacoco")
dependencyManagement {
imports {
mavenBom("org.springframework.cloud:spring-cloud-dependencies:${project.properties["springCloudDependenciesVersion"]}")
}
}
dependencies {
// Web
runtimeOnly("org.springframework.boot:spring-boot-starter-validation")
// Spring
implementation("org.springframework.boot:spring-boot-starter")
// Serialize
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
// Lombok
implementation("org.projectlombok:lombok")
annotationProcessor("org.projectlombok:lombok")
// Test
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
// testcontainers:mysql 이 jdbc 사용함
testRuntimeOnly("com.mysql:mysql-connector-j")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("com.ninja-squad:springmockk:${project.properties["springMockkVersion"]}")
testImplementation("org.mockito:mockito-core:${project.properties["mockitoVersion"]}")
testImplementation("org.instancio:instancio-junit:${project.properties["instancioJUnitVersion"]}")
// Testcontainers
testImplementation("org.springframework.boot:spring-boot-testcontainers")
testImplementation("org.testcontainers:testcontainers")
testImplementation("org.testcontainers:junit-jupiter")
}
tasks.withType(Jar::class) { enabled = true }
tasks.withType(BootJar::class) { enabled = false }
configure(allprojects.filter { it.parent?.name.equals("apps") }) {
tasks.withType(Jar::class) { enabled = false }
tasks.withType(BootJar::class) { enabled = true }
}
tasks.test {
maxParallelForks = 1
useJUnitPlatform()
systemProperty("user.timezone", "Asia/Seoul")
systemProperty("spring.profiles.active", "test")
jvmArgs("-Xshare:off")
}
tasks.withType<JacocoReport> {
mustRunAfter("test")
executionData(fileTree(layout.buildDirectory.asFile).include("jacoco/*.exec"))
reports {
xml.required = true
csv.required = false
html.required = false
}
afterEvaluate {
classDirectories.setFrom(
files(
classDirectories.files.map {
fileTree(it)
},
),
)
}
}
}
// module-container 는 task 를 실행하지 않도록 한다.
project("apps") { tasks.configureEach { enabled = false } }
project("modules") { tasks.configureEach { enabled = false } }
project("supports") { tasks.configureEach { enabled = false } }