123 lines
3.6 KiB
Kotlin
123 lines
3.6 KiB
Kotlin
plugins {
|
|
java
|
|
id("org.springframework.boot") version "3.5.3"
|
|
id("io.spring.dependency-management") version "1.1.7"
|
|
jacoco
|
|
checkstyle
|
|
idea
|
|
}
|
|
|
|
group = "com.cleverthis.clevermicro"
|
|
version = "0.0.1-SNAPSHOT"
|
|
|
|
java {
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(21)
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
compileOnly {
|
|
extendsFrom(configurations.annotationProcessor.get())
|
|
}
|
|
}
|
|
|
|
configurations.all {
|
|
// disable the cache, so it will fetch the latest snapshot for client api
|
|
resolutionStrategy.cacheChangingModulesFor(30, TimeUnit.SECONDS)
|
|
resolutionStrategy.cacheDynamicVersionsFor(30, TimeUnit.SECONDS)
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
maven {
|
|
name = "cleverthis-forgejo-maven"
|
|
url = uri("https://git.cleverthis.com/api/packages/clevermicro/maven")
|
|
// disable auth since artifacts are publicly available
|
|
// if (System.getenv("MAVEN_TOKEN").isNullOrBlank()) {
|
|
// credentials(HttpHeaderCredentials::class) {
|
|
// name = "Authorization"
|
|
// val token =
|
|
// findProperty("cleverThisForgejoToken") as String? ?: error("Token not found")
|
|
// value = "token $token"
|
|
// }
|
|
// } else {
|
|
// credentials(HttpHeaderCredentials::class) {
|
|
// name = "Authorization"
|
|
// val token = System.getenv("MAVEN_TOKEN")
|
|
// value = "token $token"
|
|
// }
|
|
// }
|
|
// authentication {
|
|
// create("header", HttpHeaderAuthentication::class)
|
|
// }
|
|
}
|
|
}
|
|
|
|
extra["springCloudVersion"] = "2025.0.0"
|
|
|
|
dependencyManagement {
|
|
imports {
|
|
mavenBom("org.springframework.cloud:spring-cloud-dependencies:${property("springCloudVersion")}")
|
|
}
|
|
}
|
|
|
|
// https://javadoc.io/doc/org.mockito/mockito-core/latest/org.mockito/org/mockito/Mockito.html#0.3
|
|
val mockitoAgent = configurations.create("mockitoAgent")
|
|
dependencies {
|
|
implementation("org.springframework.boot:spring-boot-starter-validation")
|
|
implementation("org.springframework.boot:spring-boot-starter-webflux")
|
|
implementation("org.springframework.cloud:spring-cloud-starter-consul-config")
|
|
compileOnly("org.projectlombok:lombok")
|
|
annotationProcessor("org.projectlombok:lombok")
|
|
|
|
// clevermicro
|
|
implementation("com.cleverthis.clevermicro:core:0.2.0-SNAPSHOT")
|
|
|
|
// keycloak admin client
|
|
implementation("org.keycloak:keycloak-admin-client:26.0.6")
|
|
|
|
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
|
testImplementation("io.projectreactor:reactor-test")
|
|
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
|
testImplementation("com.squareup.okhttp3:mockwebserver:4.12.0")
|
|
mockitoAgent("org.mockito:mockito-core") { isTransitive = false }
|
|
}
|
|
|
|
tasks.withType<Test> {
|
|
jvmArgs("-javaagent:${mockitoAgent.asPath}")
|
|
useJUnitPlatform()
|
|
// generate jacoco test report
|
|
finalizedBy("jacocoTestReport")
|
|
// show full output streams so we can debug for pipelines
|
|
testLogging {
|
|
showStandardStreams = true
|
|
}
|
|
}
|
|
|
|
tasks.jacocoTestReport {
|
|
dependsOn(tasks.test)
|
|
reports {
|
|
xml.required.set(true)
|
|
html.required.set(true)
|
|
}
|
|
}
|
|
|
|
checkstyle {
|
|
toolVersion = "10.23.1"
|
|
configFile = file("${project.rootDir}/checkstyle.xml")
|
|
isShowViolations = true
|
|
isIgnoreFailures = false
|
|
maxWarnings = 0
|
|
maxErrors = 0
|
|
|
|
sourceSets = setOf(project.sourceSets["main"])
|
|
}
|
|
|
|
idea { // tell IDEA to always download source code and javadoc
|
|
module {
|
|
isDownloadJavadoc = true
|
|
isDownloadSources = true
|
|
}
|
|
}
|