fixing gradle build
This commit is contained in:
@@ -1,34 +1,30 @@
|
||||
plugins {
|
||||
// Definiert dieses Modul als ein Standard Kotlin/JVM-Modul.
|
||||
alias(libs.plugins.kotlin.jvm)
|
||||
// Aktiviert das Kotlinx Serialization Plugin, da unsere DTOs und Enums
|
||||
// als @Serializable markiert sind.
|
||||
// KORREKTUR: Von JVM zu Multiplattform wechseln
|
||||
alias(libs.plugins.kotlin.multiplatform)
|
||||
alias(libs.plugins.kotlin.serialization)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Stellt sicher, dass dieses Modul die zentralen Versionen aus unserem BOM (Bill of Materials)
|
||||
// im platform-Modul respektiert. `api` wird verwendet, damit abhängige Module
|
||||
// diese Platform-Definitionen ebenfalls "erben".
|
||||
api(projects.platform.platformDependencies)
|
||||
// KORREKTUR: Diesen Block hinzufügen, um die Ziele zu definieren
|
||||
kotlin {
|
||||
jvm()
|
||||
js(IR) {
|
||||
browser()
|
||||
}
|
||||
|
||||
// --- Kern-Abhängigkeiten für das Domänen-Modell ---
|
||||
// Diese Bibliotheken definieren die grundlegenden Datentypen unseres Modells.
|
||||
// Wir verwenden `api` anstelle von `implementation`, damit Services, die
|
||||
// `core-domain` einbinden, diese Typen ebenfalls direkt nutzen können.
|
||||
|
||||
// Stellt den `Uuid`-Typ für unsere eindeutigen IDs bereit.
|
||||
api(libs.uuid)
|
||||
|
||||
// Stellt die `kotlinx.serialization`-Engine bereit, insbesondere für JSON.
|
||||
api(libs.kotlinx.serialization.json)
|
||||
|
||||
// Stellt moderne Datums- und Zeit-Typen wie `Instant` und `LocalDate` bereit.
|
||||
api(libs.kotlinx.datetime)
|
||||
|
||||
// --- Testing ---
|
||||
// Stellt die notwendigen Bibliotheken für das Schreiben von Tests bereit.
|
||||
// `testImplementation` sorgt dafür, dass diese Bibliotheken nicht Teil
|
||||
// des finalen produktiven Codes werden.
|
||||
testImplementation(projects.platform.platformTesting)
|
||||
sourceSets {
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
// Die Abhängigkeiten kommen hier rein
|
||||
api(projects.platform.platformDependencies)
|
||||
api(libs.uuid)
|
||||
api(libs.kotlinx.serialization.json)
|
||||
api(libs.kotlinx.datetime)
|
||||
}
|
||||
}
|
||||
val commonTest by getting {
|
||||
dependencies {
|
||||
implementation(projects.platform.platformTesting)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +1,41 @@
|
||||
plugins {
|
||||
// Wendet das Kotlin JVM Plugin über den zentralen Alias an.
|
||||
alias(libs.plugins.kotlin.jvm)
|
||||
// KORREKTUR: Von JVM zu Multiplattform wechseln
|
||||
alias(libs.plugins.kotlin.multiplatform)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Stellt sicher, dass dieses Modul die zentralen Versionen aus unserem BOM respektiert.
|
||||
api(projects.platform.platformDependencies)
|
||||
kotlin {
|
||||
jvm()
|
||||
js(IR) {
|
||||
browser()
|
||||
}
|
||||
|
||||
// Stellt die reinen Domänen-Klassen und -Interfaces aus dem `core-domain`-Modul bereit.
|
||||
// `api` ist hier zwingend, da `core-utils` eine Implementierung von `core-domain` ist.
|
||||
api(projects.core.coreDomain)
|
||||
|
||||
// --- Coroutines & Asynchronität ---
|
||||
api(libs.kotlinx.coroutines.core)
|
||||
|
||||
// --- Datenbank-Management ---
|
||||
api(libs.exposed.core)
|
||||
api(libs.exposed.dao)
|
||||
api(libs.exposed.jdbc)
|
||||
api(libs.exposed.kotlin.datetime) // exposed-kotlin-datetime -> exposed.kotlin.datetime
|
||||
// KORREKTUR: Der Alias `hikari-cp` wird zu `hikariCp` umgewandelt.
|
||||
api(libs.hikari.cp)
|
||||
api(libs.flyway.core)
|
||||
api(libs.flyway.postgresql)
|
||||
|
||||
// --- Service Discovery ---
|
||||
api(libs.consul.client)
|
||||
|
||||
// --- Utilities ---
|
||||
// Stellt die BigDecimal-Implementierung für den Serializer bereit.
|
||||
api(libs.bignum)
|
||||
|
||||
// --- Testing ---
|
||||
testImplementation(projects.platform.platformTesting)
|
||||
sourceSets {
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
// Diese sind plattformunabhängig und können geteilt werden
|
||||
api(projects.platform.platformDependencies)
|
||||
api(projects.core.coreDomain)
|
||||
api(libs.kotlinx.coroutines.core)
|
||||
api(libs.bignum)
|
||||
}
|
||||
}
|
||||
val jvmMain by getting {
|
||||
dependencies {
|
||||
// DIESE SIND NUR FÜR DIE JVM!
|
||||
api(libs.exposed.core)
|
||||
api(libs.exposed.dao)
|
||||
api(libs.exposed.jdbc)
|
||||
api(libs.exposed.kotlin.datetime)
|
||||
api(libs.hikari.cp)
|
||||
api(libs.flyway.core)
|
||||
api(libs.flyway.postgresql)
|
||||
api(libs.consul.client)
|
||||
}
|
||||
}
|
||||
val commonTest by getting {
|
||||
dependencies {
|
||||
implementation(projects.platform.platformTesting)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-2
@@ -21,12 +21,13 @@ class ServiceRegistration internal constructor(
|
||||
fun register() {
|
||||
if (isRegistered) return
|
||||
try {
|
||||
// Der `register`-Aufruf ist korrekt, da das `registration`-Objekt
|
||||
// bereits außerhalb vollständig und korrekt gebaut wurde.
|
||||
consul.agentClient().register(registration)
|
||||
isRegistered = true
|
||||
println("Service '${registration.name()}' mit ID '${registration.id()}' erfolgreich bei Consul registriert.")
|
||||
} catch (e: Exception) {
|
||||
println("FEHLER: Service-Registrierung bei Consul fehlgeschlagen: ${e.message}")
|
||||
// Fehler weiterwerfen, um den Anwendungsstart zu stoppen
|
||||
throw IllegalStateException("Could not register service with Consul", e)
|
||||
}
|
||||
}
|
||||
@@ -34,6 +35,7 @@ class ServiceRegistration internal constructor(
|
||||
fun deregister() {
|
||||
if (!isRegistered) return
|
||||
try {
|
||||
// Der `deregister`-Aufruf ist korrekt. Er erwartet die Service-ID als einfachen String.
|
||||
consul.agentClient().deregister(registration.id())
|
||||
isRegistered = false
|
||||
println("Service '${registration.name()}' mit ID '${registration.id()}' erfolgreich bei Consul deregistriert.")
|
||||
@@ -66,7 +68,8 @@ class ServiceRegistrar(private val appConfig: AppConfig) {
|
||||
val serviceId = "$serviceName-${UUID.randomUUID()}"
|
||||
val hostAddress = InetAddress.getLocalHost().hostAddress
|
||||
|
||||
// KORREKTUR: Der Aufruf erfolgt über die `Registration`-Klasse, nicht `ImmutableRegistration`.
|
||||
// KORREKTUR: Der Health Check MUSS über die statische Factory-Methode `http`
|
||||
// der `Registration.RegCheck`-Klasse erstellt werden. Dies war die Hauptfehlerquelle.
|
||||
val healthCheck = Registration.RegCheck.http(
|
||||
"http://$hostAddress:$servicePort/health", // Standard-Health-Check-Pfad
|
||||
10L, // Intervall in Sekunden
|
||||
|
||||
Reference in New Issue
Block a user