df5919fac8
This commit introduces a major refactoring of the build system and the core infrastructure modules. The primary goal is to establish a strict "Single Source of Truth" for all dependencies using Gradle Version Catalogs and to create a clean, maintainable, and scalable foundation for all current and future services. ### 1. Centralized Dependency Management (`libs.versions.toml`) - **Established Single Source of Truth:** All dependency versions are now exclusively managed in `gradle/libs.versions.toml`. Hardcoded versions have been removed from all build scripts. - **Introduced Gradle Bundles:** To simplify module dependencies, several bundles have been created (e.g., `testing-jvm`, `redis-cache`, `spring-cloud-gateway`, `monitoring-client`). This drastically reduces boilerplate in the `build.gradle.kts` files and improves readability. - **Cleaned up Aliases:** All library and plugin aliases have been standardized for consistency. ### 2. Infrastructure Module Refactoring All infrastructure modules (`core`, `platform`, `auth`, `cache`, `event-store`, `messaging`, `monitoring`, `gateway`) have been refactored to align with the new dependency management strategy. - **Simplified Build Scripts:** The `build.gradle.kts` for each module now uses the new bundles and aliases, making them significantly cleaner and easier to understand. - **Consistent Structure:** The architecture of each module now clearly follows the Port-Adapter pattern where applicable (e.g., `cache-api`/`redis-cache`). - **Standardized `platform-bom`:** The project's own Bill of Materials (`platform-bom`) now also includes the Spring Cloud BOM, ensuring version consistency for all Spring-related dependencies. ### 3. Added Infrastructure Documentation To improve onboarding and architectural understanding, a dedicated `README-*.md` file has been created for each refactored infrastructure module: - `README-CORE.md` - `README-PLATFORM.md` - `README-INFRA-AUTH.md` - `README-INFRA-CACHE.md` - `README-INFRA-EVENT-STORE.md` - `README-INFRA-MESSAGING.md` - `README-INFRA-MONITORING.md` - `README-INFRA-GATEWAY.md` These documents explain the purpose, architecture, and usage of each component within the system. This lays the groundwork for our "Tracer Bullet" development approach.
87 lines
3.1 KiB
Kotlin
87 lines
3.1 KiB
Kotlin
/*plugins {
|
|
alias(libs.plugins.kotlin.jvm)
|
|
alias(libs.plugins.kotlin.serialization)
|
|
alias(libs.plugins.ktor)
|
|
alias(libs.plugins.spring.dependencyManagement)
|
|
application
|
|
}
|
|
|
|
application {
|
|
mainClass.set("at.mocode.infrastructure.gateway.ApplicationKt")
|
|
}
|
|
|
|
dependencies {
|
|
api(platform(libs.spring.boot.dependencies))
|
|
implementation(projects.platform.platformDependencies)
|
|
implementation(projects.core.coreDomain)
|
|
implementation(projects.core.coreUtils)
|
|
|
|
implementation(projects.infrastructure.auth.authClient)
|
|
implementation(projects.infrastructure.monitoring.monitoringClient)
|
|
|
|
// --- Ktor Server ---
|
|
implementation(libs.ktor.server.core)
|
|
implementation(libs.ktor.server.netty)
|
|
implementation(libs.ktor.server.contentNegotiation)
|
|
implementation(libs.ktor.server.serialization.kotlinx.json)
|
|
implementation(libs.ktor.server.cors)
|
|
implementation(libs.ktor.server.callLogging)
|
|
implementation(libs.ktor.server.defaultHeaders)
|
|
implementation(libs.ktor.server.statusPages)
|
|
implementation(libs.ktor.server.auth)
|
|
implementation(libs.ktor.server.authJwt)
|
|
implementation(libs.ktor.server.rateLimit)
|
|
implementation(libs.ktor.server.metrics.micrometer)
|
|
|
|
// --- OpenAPI & Swagger for Ktor ---
|
|
implementation(libs.ktor.server.openapi)
|
|
implementation(libs.ktor.server.swagger)
|
|
|
|
// --- Ktor Client (damit der Gateway Anfragen an die Backend-Services weiterleiten kann) ---
|
|
implementation(libs.ktor.client.core)
|
|
implementation(libs.ktor.client.cio)
|
|
implementation(libs.ktor.client.contentNegotiation)
|
|
implementation(libs.ktor.client.serialization.kotlinx.json)
|
|
|
|
// --- Monitoring ---
|
|
implementation(libs.micrometer.prometheus)
|
|
|
|
// --- Testing ---
|
|
testImplementation(projects.platform.platformTesting)
|
|
testImplementation(libs.ktor.server.tests)
|
|
}*/
|
|
|
|
// Dieses Modul ist das API-Gateway und der einzige öffentliche Einstiegspunkt
|
|
// für alle externen Anfragen an das Meldestelle-System.
|
|
plugins {
|
|
alias(libs.plugins.kotlin.jvm)
|
|
alias(libs.plugins.kotlin.spring)
|
|
alias(libs.plugins.spring.boot)
|
|
alias(libs.plugins.spring.dependencyManagement)
|
|
}
|
|
|
|
// Konfiguriert die Hauptklasse für das ausführbare JAR.
|
|
springBoot {
|
|
mainClass.set("at.mocode.infrastructure.gateway.GatewayApplicationKt")
|
|
}
|
|
|
|
dependencies {
|
|
// Stellt sicher, dass alle Versionen aus der zentralen BOM kommen.
|
|
implementation(platform(projects.platform.platformBom))
|
|
// Stellt gemeinsame Abhängigkeiten bereit.
|
|
implementation(projects.platform.platformDependencies)
|
|
|
|
// OPTIMIERUNG: Verwendung des `spring-cloud-gateway`-Bundles.
|
|
// Es enthält den Gateway-Starter und den Consul Discovery Client.
|
|
implementation(libs.bundles.spring.cloud.gateway)
|
|
|
|
// Bindet die wiederverwendbare Logik zur JWT-Validierung ein.
|
|
implementation(projects.infrastructure.auth.authClient)
|
|
|
|
// Bindet die wiederverwendbare Logik für Metriken und Tracing ein.
|
|
implementation(projects.infrastructure.monitoring.monitoringClient)
|
|
|
|
// Stellt alle Test-Abhängigkeiten gebündelt bereit.
|
|
testImplementation(projects.platform.platformTesting)
|
|
}
|