756a80c5b9
Signed-off-by: Alan Brault <alan.brault@visus.io>
157 lines
9.9 KiB
Kotlin
157 lines
9.9 KiB
Kotlin
plugins {
|
|
kotlin("jvm") version "2.2.21"
|
|
kotlin("plugin.spring") version "2.2.21"
|
|
id("org.springframework.boot") version "4.1.0-M2"
|
|
id("io.spring.dependency-management") version "1.1.7"
|
|
id("org.jlleitschuh.gradle.ktlint") version "14.2.0"
|
|
id("tech.mappie.plugin") version "2.2.21-2.1.1"
|
|
id("com.github.ben-manes.versions") version "0.53.0"
|
|
}
|
|
|
|
group = "io.visus.demos"
|
|
version = "0.0.1-SNAPSHOT"
|
|
description = "kotlin-api"
|
|
|
|
java {
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(21)
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
ktlint {
|
|
version.set("1.8.0")
|
|
android.set(false)
|
|
ignoreFailures.set(false)
|
|
reporters {
|
|
reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.PLAIN)
|
|
}
|
|
filter {
|
|
exclude("**/build/**")
|
|
exclude("**/generated/**")
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
// Environment Configuration (.env file support)
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
developmentOnly("me.paulschwarz:springboot4-dotenv:5.1.0")
|
|
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
// Core Spring Boot & Kotlin
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
implementation("org.springframework.boot:spring-boot-starter-webflux")
|
|
implementation("org.jetbrains.kotlin:kotlin-reflect")
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:1.10.2")
|
|
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
// JSON Processing (Jackson)
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
// Spring Boot 4.x uses Jackson 3.x (tools.jackson.core)
|
|
// Third-party libs still use Jackson 2.x (see resolutionStrategy below)
|
|
implementation("tools.jackson.core:jackson-core:3.1.0")
|
|
implementation("tools.jackson.core:jackson-databind:3.1.0")
|
|
implementation("tools.jackson.module:jackson-module-kotlin:3.1.0")
|
|
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
// Data Persistence (MongoDB)
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
implementation("org.springframework.boot:spring-boot-starter-data-mongodb-reactive")
|
|
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
// Security & Authentication
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
implementation("org.springframework.boot:spring-boot-starter-security")
|
|
implementation("com.password4j:password4j:1.8.4")
|
|
|
|
// JWT Token Management
|
|
implementation("io.jsonwebtoken:jjwt-api:0.13.0")
|
|
runtimeOnly("io.jsonwebtoken:jjwt-impl:0.13.0")
|
|
runtimeOnly("io.jsonwebtoken:jjwt-jackson:0.13.0")
|
|
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
// Validation
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
implementation("org.hibernate.validator:hibernate-validator:9.1.0.Final")
|
|
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
// API Documentation (OpenAPI/Swagger)
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
implementation("org.springdoc:springdoc-openapi-starter-webflux-ui:3.0.2")
|
|
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
// Mapping & Utilities
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
implementation("tech.mappie:mappie-api:2.2.21-2.1.1")
|
|
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
// UUID Generation
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
implementation("com.fasterxml.uuid:java-uuid-generator:5.2.0")
|
|
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
// Testing
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
// Core Spring Boot testing support (includes JUnit 5, AssertJ, Mockito, JSONPath, etc.)
|
|
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
|
|
|
// Spring Boot domain-specific test modules
|
|
testImplementation("org.springframework.boot:spring-boot-starter-mongodb-test")
|
|
testImplementation("org.springframework.boot:spring-boot-starter-security-test")
|
|
testImplementation("org.springframework.boot:spring-boot-starter-webflux-test")
|
|
|
|
// Kotlin testing support
|
|
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
|
|
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.2")
|
|
|
|
// Kotlin-native mocking (more idiomatic than Mockito for Kotlin)
|
|
testImplementation("io.mockk:mockk:1.14.9")
|
|
testImplementation("com.ninja-squad:springmockk:5.0.1")
|
|
|
|
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
|
}
|
|
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
// Dependency Resolution Strategy
|
|
// ════════════════════════════════════════════════════════════════════════════════
|
|
// Force Jackson version alignment to prevent conflicts between:
|
|
// - Spring Boot 4.x (uses Jackson 3.x / tools.jackson.core)
|
|
// - Third-party libs still on Jackson 2.x (com.fasterxml.jackson):
|
|
// * springdoc-openapi:3.0.2 → brings Jackson 2.19.2
|
|
// * jjwt-jackson:0.12.6 → brings Jackson 2.12.7.1
|
|
configurations.all {
|
|
resolutionStrategy.eachDependency {
|
|
// Ensure Jackson 3.x is at latest stable version
|
|
if (requested.group == "tools.jackson.core") {
|
|
useVersion("3.1.0")
|
|
}
|
|
// Upgrade legacy Jackson 2.x dependencies for security and compatibility
|
|
if (requested.group == "com.fasterxml.jackson.core") {
|
|
if (requested.name == "jackson-annotations") {
|
|
useVersion("2.21") // Annotations compatibility layer
|
|
} else {
|
|
useVersion("2.21.1") // Core Jackson 2.x libraries
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
kotlin {
|
|
compilerOptions {
|
|
freeCompilerArgs.addAll("-Xjsr305=strict", "-Xannotation-default-target=param-property")
|
|
}
|
|
}
|
|
|
|
tasks.withType<Test> {
|
|
useJUnitPlatform()
|
|
}
|
|
|
|
tasks.named("check") {
|
|
dependsOn("ktlintCheck")
|
|
}
|