-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
156 lines (134 loc) · 5.58 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
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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import kotlin.script.experimental.api.ScriptCompilationConfiguration.Default.properties
plugins {
id("org.springframework.boot") version "2.7.16" apply false
id("io.spring.dependency-management") version "1.0.15.RELEASE" apply false
kotlin("jvm") version "1.6.21"
kotlin("plugin.spring") version "1.6.21"
kotlin("plugin.jpa") version "1.6.21"
id("com.diffplug.spotless") version "6.18.0" // spotless
id("org.sonarqube") version "3.5.0.2730" // 소나 클라우드
id("jacoco")
}
java.sourceCompatibility = JavaVersion.VERSION_17
sonarqube {
properties {
property ("sonar.projectKey", "wifi6-api")
property ("sonar.organization", "wifi6-1")
property ("sonar.host.url", "https://sonarcloud.io")
property ("sonar.sources", "src")
property ("sonar.language", "Kotlin")
property ("sonar.sourceEncoding", "UTF-8")
property ("sonar.test.inclusions", "**/*Test.java")
property ("sonar.exclusions", "**/test/**, **/Q*.kt, **/*Doc*.kt, **/resources/** ,**/*Application*.kt , **/*Config*.kt, **/*Dto*.kt, **/*Request*.kt, **/*Response*.kt ,**/*Exception*.kt ,**/*ErrorCode*.kt")
property ("sonar.java.coveragePlugin", "jacoco")
}
}
/*
allOpen{
annotation("javax.persistence.Entity")
annotation("javax.persistence.MappedSuperclass")
annotation("javax.persistence.Embeddable")
}*/
allprojects {
group = "com.jnu"
version = "0.0.1-SNAPSHOT"
repositories {
mavenCentral()
}
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "org.jetbrains.kotlin.plugin.spring")
apply(plugin = "org.springframework.boot")
apply(plugin = "io.spring.dependency-management")
apply(plugin = "jacoco" )
apply(plugin = "org.jetbrains.kotlin.plugin.jpa")
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "11"
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
// tasks.withType<JavaExec> {
// doLast {
// commandLine("bash", "load_env.sh")
// }
// }
dependencies {
// feign
api ("io.github.openfeign:feign-httpclient:12.2")
api ("org.springframework.cloud:spring-cloud-starter-openfeign:3.1.4")
//influx
// implementation("com.fasterxml.jackson.core:jackson-databind:2.10.2")
implementation("com.influxdb:influxdb-client-kotlin:6.6.0")
api("com.mysql:mysql-connector-j:8.1.0")
implementation("org.springframework.boot:spring-boot-starter-data-jpa:2.5.8")
// batch
implementation("org.springframework.boot:spring-boot-starter-batch")
testImplementation("org.springframework.batch:spring-batch-test")
implementation("org.springframework.boot:spring-boot-starter-quartz")
implementation("io.github.microutils:kotlin-logging:2.0.11")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-web-services")
// implementation("org.springframework.boot:spring-boot-starter-webflux")
// implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("io.projectreactor.kotlin:reactor-kotlin-extensions")
implementation("org.jetbrains.kotlin:kotlin-reflect")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("io.projectreactor:reactor-test")
}
tasks.getByName<Jar>("jar") {
enabled = false
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs += "-Xjsr305=strict"
jvmTarget = "17"
}
}
tasks.test {
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run
}
tasks.jacocoTestReport {
dependsOn(tasks.test) // tests are required to run before generating the report
reports {
html.required.set(true) // html 설정
csv.required.set(true) // csv 설정
xml.required.set(true)
xml.outputLocation.set(File("${buildDir}/reports/jacoco.xml"))
}
classDirectories.setFrom(
files(classDirectories.files.map {
fileTree(it) { // jacoco file 테스트 커버리지 측정안할 목록
exclude("**/*Application*",
"**/*Config*",
"**/*Dto*",
"**/*Request*",
"**/*Response*",
"**/*Interceptor*",
"**/*Exception*" ,
"**/Q*") // Query Dsl 용이긴하나 Q로 시작하는 다른 클래스를 뺄 위험이 있음.
}
})
)
}
sonarqube {
properties {
property("sonar.java.binaries", "${buildDir}/classes")
property("sonar.coverage.jacoco.xmlReportPaths", "${buildDir}/reports/jacoco.xml")
}
}
}
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
kotlin {
// version, setUseExperimental, userData and editorConfigOverride are all optional
target ("**/*.kt")
ktlint("0.48.0")
// kt lint 설정중에
// no wild card import 의경우를 그대로 따라갑니다. 대신 ide 에서 설정을 해주셔야합니다.
// https://blog.leocat.kr/notes/2020/12/14/intellij-avoid-wildcard-imports-in-kotlin-with-intellij
}
}