This repository has been archived by the owner on Aug 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
118 lines (95 loc) · 3.12 KB
/
build.gradle.kts
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
import io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.springframework.boot.gradle.tasks.bundling.BootJar
plugins {
base
id("org.springframework.boot")
id("io.spring.dependency-management")
kotlin("jvm")
kotlin("plugin.spring")
kotlin("plugin.jpa") apply false
kotlin("kapt")
id("com.google.cloud.tools.jib") version "3.1.4" apply false
jacoco
}
configurations {
compileOnly {
extendsFrom(configurations.annotationProcessor.get())
}
}
allprojects {
repositories {
mavenCentral()
}
}
subprojects {
group = "awesome.kotlin.springboot"
version = "0.0.1-SNAPSHOT"
apply(plugin = "kotlin")
apply(plugin = "kotlin-kapt")
apply(plugin = "kotlin-spring")
apply(plugin = "org.springframework.boot")
apply(plugin = "io.spring.dependency-management")
apply(plugin = "jacoco")
java.sourceCompatibility = JavaVersion.VERSION_16
java.targetCompatibility = JavaVersion.VERSION_16
the<DependencyManagementExtension>().apply {
val springCloudVersion: String by project
imports {
mavenBom("org.springframework.cloud:spring-cloud-dependencies:$springCloudVersion")
}
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
runtimeOnly("mysql:mysql-connector-java")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test")
testImplementation("org.springframework.boot:spring-boot-starter-test")
}
val jar: Jar by tasks
val bootJar: BootJar by tasks
bootJar.enabled = false
jar.enabled = true
jacoco {
toolVersion = "0.8.7"
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "16"
}
}
tasks.test {
extensions.configure(JacocoTaskExtension::class) {
setDestinationFile(file("$buildDir/jacoco/jacoco.exec"))
}
finalizedBy("jacocoTestReport")
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.jacocoTestReport {
reports {
xml.isEnabled = true
html.isEnabled = true
}
finalizedBy("jacocoTestCoverageVerification")
classDirectories.setFrom(
fileTree(project.buildDir) {
exclude(
"**/Q*.*",
"**/*Test.*"
)
include(
"**/classes/**/main/**"
)
}
)
}
}