@@ -4,15 +4,15 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
4
4
import org.gradle.api.tasks.testing.logging.TestLogEvent
5
5
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
6
6
7
+ val detektVersion: String by project
8
+
7
9
val kotlinVersion: String by project
8
10
val springBootVersion: String by project
9
- val springCloudVersion: String by project
10
11
val jacocoToolVersion: String by project
11
12
val logbackVersion: String by project
12
13
val javaxAnnotationApiVersion: String by project
13
14
14
- val junitPlatformLauncherVersion: String by project
15
- val junitBom: String by project
15
+ val junitVersion: String by project
16
16
val mockkVersion: String by project
17
17
val springMockkVersion: String by project
18
18
@@ -29,7 +29,6 @@ val gitHubProject: String by project
29
29
val githubUrl: String by project
30
30
31
31
val feignVersion: String by project
32
- val jacksonModuleKotlin: String by project
33
32
34
33
val weNodeClientVersion: String by project
35
34
val weContractSdkVersion: String by project
@@ -42,23 +41,29 @@ plugins {
42
41
kotlin(" jvm" ) apply false
43
42
`maven- publish`
44
43
signing
45
- id(" io.codearte. nexus-staging " )
44
+ id(" io.github.gradle- nexus.publish-plugin " )
46
45
kotlin(" plugin.spring" ) apply false
47
46
id(" org.springframework.boot" ) apply false
48
47
id(" io.spring.dependency-management" ) apply false
49
- id(" io.gitlab.arturbosch.detekt" ) apply false
50
- id(" org.jlleitschuh.gradle.ktlint" ) apply false
48
+ id(" io.gitlab.arturbosch.detekt" )
51
49
id(" com.palantir.git-version" ) apply false
52
50
id(" com.gorylenko.gradle-git-properties" ) apply false
53
51
id(" fr.brouillard.oss.gradle.jgitver" )
54
52
id(" org.jetbrains.dokka" )
55
53
id(" jacoco" )
56
54
}
57
55
58
- nexusStaging {
59
- serverUrl = " $sonaTypeBasePath /service/local/"
60
- username = sonaTypeMavenUser
61
- password = sonaTypeMavenPassword
56
+ if (sonaTypeMavenUser != null && sonaTypeMavenUser != null ) {
57
+ nexusPublishing {
58
+ repositories {
59
+ sonatype {
60
+ nexusUrl.set(uri(" $sonaTypeBasePath /service/local/" ))
61
+ snapshotRepositoryUrl.set(uri(" $sonaTypeBasePath /content/repositories/snapshots/" ))
62
+ username.set(sonaTypeMavenUser)
63
+ password.set(sonaTypeMavenPassword)
64
+ }
65
+ }
66
+ }
62
67
}
63
68
64
69
jgitver {
@@ -141,17 +146,19 @@ configure(
141
146
apply (plugin = " kotlin" )
142
147
apply (plugin = " signing" )
143
148
apply (plugin = " io.gitlab.arturbosch.detekt" )
144
- apply (plugin = " org.jlleitschuh.gradle.ktlint" )
145
149
apply (plugin = " jacoco" )
146
150
apply (plugin = " org.jetbrains.dokka" )
147
151
148
- val jacocoCoverageFile = " $buildDir /jacocoReports/test/jacocoTestReport.xml"
152
+ dependencies {
153
+ detektPlugins(" io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion " )
154
+ }
149
155
156
+ val jacocoCoverageFile = layout.buildDirectory.file(" jacocoReports/test/jacocoTestReport.xml" ).get().asFile
150
157
tasks.withType<JacocoReport > {
151
158
reports {
152
159
xml.apply {
153
160
required.set(true )
154
- outputLocation.set(file( jacocoCoverageFile) )
161
+ outputLocation.set(jacocoCoverageFile)
155
162
}
156
163
}
157
164
}
@@ -181,6 +188,23 @@ configure(
181
188
buildUponDefaultConfig = true
182
189
}
183
190
191
+ tasks.register<Detekt >(" detektFormat" ) {
192
+ description = " Runs detekt with auto-correct to format the code."
193
+ group = " formatting"
194
+ autoCorrect = true
195
+ exclude(" resources/" )
196
+ exclude(" build/" )
197
+ config.setFrom(detektConfigFilePath)
198
+ setSource(
199
+ files(
200
+ " src/main/java" ,
201
+ " src/test/java" ,
202
+ " src/main/kotlin" ,
203
+ " src/test/kotlin" ,
204
+ )
205
+ )
206
+ }
207
+
184
208
val sourcesJar by tasks.creating(Jar ::class ) {
185
209
group = JavaBasePlugin .DOCUMENTATION_GROUP
186
210
description = " Assembles sources JAR"
@@ -262,7 +286,7 @@ configure(
262
286
mavenBom(" com.wavesenterprise:we-node-client-bom:$weNodeClientVersion " )
263
287
mavenBom(" com.wavesenterprise:we-contract-sdk-bom:$weContractSdkVersion " )
264
288
mavenBom(" io.github.openfeign:feign-bom:$feignVersion " )
265
- mavenBom(" org.junit:junit-bom:$junitBom " )
289
+ mavenBom(" org.junit:junit-bom:$junitVersion " )
266
290
}
267
291
dependencies {
268
292
dependency(" org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:$kotlinCoroutinesVersion " )
@@ -274,12 +298,12 @@ configure(
274
298
tasks.withType<KotlinCompile >().configureEach {
275
299
kotlinOptions {
276
300
freeCompilerArgs = listOf (" -Xjsr305=strict" )
277
- jvmTarget = JavaVersion .VERSION_1_8 .toString()
301
+ jvmTarget = JavaVersion .VERSION_17 .toString()
278
302
}
279
303
}
280
304
281
305
jacoco {
282
306
toolVersion = jacocoToolVersion
283
- reportsDirectory.set(file( " $buildDir / jacocoReports" ))
307
+ reportsDirectory.set(layout.buildDirectory.dir( " jacocoReports" ).get().asFile )
284
308
}
285
309
}
0 commit comments