Repository: MTES-MCT/monitorenv
Pull request #2164: tech: Montée de version de la JVM et nettoyage de dépendences
Author: login: maximeperraultdev
Labels: name: tech. enhancement
description: technical enhancement
Created: 2025-03-13T09:54:50Z | Merged: 2025-03-13T15:56:02Z

- upgrade JVM compatibility from 17 to 21
- reorganize dependencies

----

- [ ] Tests E2E (Cypress)



Diff:
diff --git a/backend/build.gradle.kts b/backend/build.gradle.kts
index 14c139eb77..023d5caa63 100644
--- a/backend/build.gradle.kts
+++ b/backend/build.gradle.kts
@@ -1,7 +1,12 @@
+import org.jetbrains.kotlin.gradle.dsl.JvmTarget
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+import org.jlleitschuh.gradle.ktlint.KtlintExtension
+
 plugins {
     `java-library`
     `maven-publish`
     id("org.springframework.boot") version "3.4.3"
+    id("io.spring.dependency-management") version "1.1.4"
     id("org.jlleitschuh.gradle.ktlint") version "12.2.0"
     kotlin("jvm") version "2.1.10"
     kotlin("plugin.spring") version "2.1.10"
@@ -15,8 +20,13 @@ repositories {
     mavenCentral()
 }
 
+group = "fr.gouv.cacem"
+version = "VERSION_TO_CHANGE"
+description = "MonitorEnv"
+java.sourceCompatibility = JavaVersion.VERSION_21
+
 kotlin {
-    jvmToolchain(17)
+    jvmToolchain(21)
 }
 
 java {
@@ -24,6 +34,11 @@ java {
     withSourcesJar()
 }
 
+// https://github.com/JLLeitschuh/ktlint-gradle/issues/809
+ktlint {
+    version.set("1.4.1")
+}
+
 noArg {
     invokeInitializers = true
 }
@@ -32,108 +47,84 @@ configurations.all {
     exclude(group = "org.springframework.boot", module = "spring-boot-starter-logging")
 }
 
-tasks.named("compileKotlin", org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask::class.java) {
+tasks.withType<KotlinCompile> {
     compilerOptions {
-        freeCompilerArgs.add("-Xjsr305=strict")
-        // jvmTarget.set(JvmTarget.JVM_17)
-        // javaParameters.set(true)
+        jvmTarget.set(JvmTarget.JVM_21)
+        freeCompilerArgs.set(listOf("-Xjsr305=strict"))
     }
 }
 
+val ktorVersion = "3.1.1"
+val testcontainersVersion = "1.20.5"
+val sentryVersion = "8.3.0"
+val flywayVersion = "11.3.4"
+
 dependencies {
-    implementation("org.springframework.boot:spring-boot-starter-web:3.4.3")
-    implementation("org.springframework.security:spring-security-oauth2-resource-server:6.4.3")
-    implementation("org.springframework.security:spring-security-oauth2-jose:6.4.3")
-    implementation("org.hibernate.validator:hibernate-validator:8.0.2.Final")
-    implementation("jakarta.validation:jakarta.validation-api:3.1.1")
-    implementation("org.springframework.boot:spring-boot-starter-actuator:3.4.3")
-    implementation("org.springframework.boot:spring-boot-starter-json:3.4.3")
-    implementation("org.springframework.boot:spring-boot-starter-security:3.4.3")
-    implementation("org.springframework.boot:spring-boot-starter-data-jpa:3.4.3")
+    implementation(platform("org.springframework.boot:spring-boot-dependencies:3.4.3"))
+
+    // Spring Boot
+    implementation("org.springframework.boot:spring-boot-starter-web")
+    implementation("org.springframework.boot:spring-boot-starter-security")
+    implementation("org.springframework.boot:spring-boot-starter-actuator")
+    implementation("org.springframework.boot:spring-boot-starter-cache")
+    implementation("org.springframework.boot:spring-boot-starter-data-jpa")
+    implementation("org.springframework.boot:spring-boot-starter-log4j2")
+    implementation("org.springframework.security:spring-security-oauth2-resource-server")
+    implementation("org.springframework.security:spring-security-oauth2-jose")
+    implementation("org.springframework.boot:spring-boot-configuration-processor")
+
+    // Database & Migration
+    implementation("org.postgresql:postgresql")
+    implementation("org.flywaydb:flyway-core:$flywayVersion")
+    implementation("org.flywaydb:flyway-database-postgresql:$flywayVersion")
     implementation("org.hibernate.orm:hibernate-spatial:6.6.9.Final")
-    implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.3")
-    implementation("org.n52.jackson:jackson-datatype-jts:1.2.10")
-    implementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")
-    implementation("org.flywaydb:flyway-core:11.3.4")
-    implementation("org.flywaydb:flyway-database-postgresql:11.3.4")
-    implementation("org.jetbrains.kotlin:kotlin-reflect:2.1.10")
-    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.1.10")
-    implementation("org.springframework.boot:spring-boot-configuration-processor:3.4.3")
+    implementation("org.hibernate.validator:hibernate-validator:8.0.2.Final")
+    implementation("io.hypersistence:hypersistence-utils-hibernate-63:3.9.2")
+
+    // Kotlin
+    implementation("org.jetbrains.kotlin:kotlin-reflect")
     implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1")
     implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0")
-    implementation("org.http4k:http4k-client-apache:5.46.0.0")
-    implementation("com.google.code.gson:gson:2.12.1")
-    implementation("org.springframework.boot:spring-boot-starter-cache:3.4.3")
+
+    // Jackson
+    implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.3")
+    implementation("org.n52.jackson:jackson-datatype-jts:1.2.10")
+
+    // HTTP Clients (Ktor)
+    implementation("io.ktor:ktor-client-core:$ktorVersion")
+    implementation("io.ktor:ktor-client-java:$ktorVersion")
+    implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
+    implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
+
+    // Monitoring & Logging
+    implementation("io.sentry:sentry:$sentryVersion")
+    implementation("io.sentry:sentry-log4j2:$sentryVersion")
+
+    // Cache
     implementation("com.github.ben-manes.caffeine:caffeine:3.2.0")
-    implementation("io.hypersistence:hypersistence-utils-hibernate-63:3.9.2")
-    implementation("org.springframework.boot:spring-boot-starter-log4j2:3.4.3")
-    implementation("io.ktor:ktor-client-core-jvm:3.1.1")
-    implementation("io.ktor:ktor-client-java-jvm:3.1.1")
-    implementation("io.ktor:ktor-client-content-negotiation-jvm:3.1.1")
-    implementation("io.ktor:ktor-serialization-kotlinx-json-jvm:3.1.1")
-    implementation("io.sentry:sentry:8.3.0")
-    implementation("io.sentry:sentry-log4j2:8.3.0")
+
+    // API Documentation
     implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.5")
-    runtimeOnly("org.springframework.boot:spring-boot-devtools:3.4.3")
-    runtimeOnly("org.postgresql:postgresql:42.7.5")
+
+    // Devtools
+    runtimeOnly("org.springframework.boot:spring-boot-devtools")
+
+    // Testing
+    testImplementation("org.springframework.security:spring-security-test")
+    testImplementation("org.springframework.boot:spring-boot-starter-test")
+    testImplementation("org.springframework.restdocs:spring-restdocs-mockmvc:3.0.3")
     testImplementation("org.assertj:assertj-core:3.27.3")
-    testImplementation("org.springframework.security:spring-security-test:6.4.3")
-    testImplementation("org.testcontainers:testcontainers:1.20.5")
-    testImplementation("org.testcontainers:postgresql:1.20.5")
-    testImplementation("io.ktor:ktor-client-mock-jvm:3.1.1")
+    testImplementation("org.testcontainers:testcontainers:$testcontainersVersion")
+    testImplementation("org.testcontainers:postgresql:$testcontainersVersion")
+    testImplementation("org.testcontainers:junit-jupiter:$testcontainersVersion")
+    testImplementation("io.ktor:ktor-client-mock:$ktorVersion")
     testImplementation("jakarta.servlet:jakarta.servlet-api:6.1.0")
     testImplementation("com.squareup.okhttp3:mockwebserver:4.12.0")
-    testImplementation("org.springframework.boot:spring-boot-starter-test:3.4.3")
-    testImplementation("org.springframework.restdocs:spring-restdocs-mockmvc:3.0.3")
-    testImplementation("org.testcontainers:junit-jupiter:1.20.5")
-    testImplementation("net.java.dev.jna:jna:5.16.0")
     testImplementation("net.ttddyy:datasource-proxy:1.10.1")
     testImplementation("io.mockk:mockk:1.13.17")
+    testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")
 }
 
-group = "fr.gouv.cacem"
-version = "VERSION_TO_CHANGE"
-description = "MonitorEnv"
-java.sourceCompatibility = JavaVersion.VERSION_17
-
-/*
-// TODO Re-add this library When there will be no more IDE conflicts
-sourceSets {
-  create("publicApi") {
-    java {
-      srcDir("src/main/kotlin/fr/gouv/cacem/monitorenv/infrastructure/api/adapters/publicapi")
-    }
-  }
-}
-
-// This publication is only runned from the CI in Github Actions
-publishing {
-  repositories {
-    maven {
-      name = "GitHubPackages"
-      url = uri("https://maven.pkg.github.com/mtes-mct/monitorenv")
-      credentials {
-        username = System.getenv("GITHUB_ACTOR")
-        password = System.getenv("GITHUB_TOKEN")
-      }
-    }
-  }
-  publications {
-    val publicApiSourceJar by tasks.registering(Jar::class) {
-      from(sourceSets["publicApi"].allSource)
-    }
-
-    register<MavenPublication>("gpr") {
-      groupId = "fr.gouv.monitor"
-      artifactId = "api"
-      version = "VERSION_TO_CHANGE"
-
-      artifact(publicApiSourceJar.get())
-    }
-  }
-}
- */
-
 springBoot {
     mainClass.set("fr.gouv.cacem.monitorenv.MonitorEnvApplicationKt")
 
@@ -155,7 +146,7 @@ tasks.withType<Javadoc> {
     options.encoding = "UTF-8"
 }
 
-configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
+configure<KtlintExtension> {
     verbose.set(true)
     android.set(false)
     outputToConsole.set(true)
diff --git a/backend/gradle/wrapper/gradle-wrapper.properties b/backend/gradle/wrapper/gradle-wrapper.properties
index 3fa8f862f7..1af9e0930b 100644
--- a/backend/gradle/wrapper/gradle-wrapper.properties
+++ b/backend/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
 networkTimeout=10000
 validateDistributionUrl=true
 zipStoreBase=GRADLE_USER_HOME
diff --git a/infra/docker/app/Dockerfile b/infra/docker/app/Dockerfile
index 1b208f9be6..cf97057420 100644
--- a/infra/docker/app/Dockerfile
+++ b/infra/docker/app/Dockerfile
@@ -8,7 +8,7 @@ ARG VERSION=NO_VERSION
 ########################################
 # Build monitorenv backend with maven #
 ########################################
-FROM gradle:8.4-jdk17 as buildBack
+FROM gradle:8.5-jdk21 as buildBack
 
 ARG GITHUB_SHA
 ARG VERSION
@@ -54,7 +54,7 @@ RUN npx pkg ./node_modules/@import-meta-env/cli/bin/import-meta-env.js \
 ######################
 # Create final image #
 ######################
-FROM azul/zulu-openjdk-alpine:17-jre
+FROM azul/zulu-openjdk-alpine:21-jre
 
 ARG VERSION
 ENV VERSION=$VERSION


Reviews:
user: login: claire2212
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-13T10:15:34Z
user: login: claire2212
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-03-13T10:15:41Z
user: login: louptheron
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-13T13:31:29Z
user: login: louptheron
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-13T13:33:53Z
user: login: maximeperraultdev
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-13T14:07:08Z

Review comments:
diff_hunk: @@ -32,108 +47,84 @@ configurations.all {
     exclude(group = "org.springframework.boot", module = "spring-boot-starter-logging")
 }
 
-tasks.named("compileKotlin", org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask::class.java) {
+tasks.withType<KotlinCompile> {
     compilerOptions {
-        freeCompilerArgs.add("-Xjsr305=strict")
-        // jvmTarget.set(JvmTarget.JVM_17)
-        // javaParameters.set(true)
+        jvmTarget.set(JvmTarget.JVM_21)
+        freeCompilerArgs.set(listOf("-Xjsr305=strict"))
     }
 }
 
+val ktorVersion = "3.1.1"
+val testcontainersVersion = "1.20.5"
+val sentryVersion = "8.3.0"
+val flywayVersion = "11.3.4"
+
 dependencies {
-    implementation("org.springframework.boot:spring-boot-starter-web:3.4.3")
-    implementation("org.springframework.security:spring-security-oauth2-resource-server:6.4.3")
-    implementation("org.springframework.security:spring-security-oauth2-jose:6.4.3")
-    implementation("org.hibernate.validator:hibernate-validator:8.0.2.Final")
-    implementation("jakarta.validation:jakarta.validation-api:3.1.1")
-    implementation("org.springframework.boot:spring-boot-starter-actuator:3.4.3")
-    implementation("org.springframework.boot:spring-boot-starter-json:3.4.3")
-    implementation("org.springframework.boot:spring-boot-starter-security:3.4.3")
-    implementation("org.springframework.boot:spring-boot-starter-data-jpa:3.4.3")
+    implementation(platform("org.springframework.boot:spring-boot-dependencies:3.4.3"))
+
+    // Spring Boot
+    implementation("org.springframework.boot:spring-boot-starter-web")
+    implementation("org.springframework.boot:spring-boot-starter-security")
+    implementation("org.springframework.boot:spring-boot-starter-actuator")
+    implementation("org.springframework.boot:spring-boot-starter-cache")
+    implementation("org.springframework.boot:spring-boot-starter-data-jpa")
+    implementation("org.springframework.boot:spring-boot-starter-log4j2")
+    implementation("org.springframework.security:spring-security-oauth2-resource-server")
+    implementation("org.springframework.security:spring-security-oauth2-jose")
+    implementation("org.springframework.boot:spring-boot-configuration-processor")
+
+    // Database & Migration
+    implementation("org.postgresql:postgresql")
+    implementation("org.flywaydb:flyway-core:$flywayVersion")
+    implementation("org.flywaydb:flyway-database-postgresql:$flywayVersion")
     implementation("org.hibernate.orm:hibernate-spatial:6.6.9.Final")
-    implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.3")
-    implementation("org.n52.jackson:jackson-datatype-jts:1.2.10")
-    implementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")
-    implementation("org.flywaydb:flyway-core:11.3.4")
-    implementation("org.flywaydb:flyway-database-postgresql:11.3.4")
-    implementation("org.jetbrains.kotlin:kotlin-reflect:2.1.10")
-    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.1.10")
-    implementation("org.springframework.boot:spring-boot-configuration-processor:3.4.3")
+    implementation("org.hibernate.validator:hibernate-validator:8.0.2.Final")
+    implementation("io.hypersistence:hypersistence-utils-hibernate-63:3.9.2")
+
+    // Kotlin
+    implementation("org.jetbrains.kotlin:kotlin-reflect")
     implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1")
     implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0")
-    implementation("org.http4k:http4k-client-apache:5.46.0.0")
-    implementation("com.google.code.gson:gson:2.12.1")
-    implementation("org.springframework.boot:spring-boot-starter-cache:3.4.3")
+
+    // Jackson
+    implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.3")
+    implementation("org.n52.jackson:jackson-datatype-jts:1.2.10")
+
+    // HTTP Clients (Ktor)
+    implementation("io.ktor:ktor-client-core:$ktorVersion")
+    implementation("io.ktor:ktor-client-java:$ktorVersion")
+    implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
+    implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
+
+    // Monitoring & Logging
+    implementation("io.sentry:sentry:$sentryVersion")
+    implementation("io.sentry:sentry-log4j2:$sentryVersion")
+
+    // Cache
     implementation("com.github.ben-manes.caffeine:caffeine:3.2.0")
-    implementation("io.hypersistence:hypersistence-utils-hibernate-63:3.9.2")
-    implementation("org.springframework.boot:spring-boot-starter-log4j2:3.4.3")
-    implementation("io.ktor:ktor-client-core-jvm:3.1.1")
-    implementation("io.ktor:ktor-client-java-jvm:3.1.1")
-    implementation("io.ktor:ktor-client-content-negotiation-jvm:3.1.1")
-    implementation("io.ktor:ktor-serialization-kotlinx-json-jvm:3.1.1")
-    implementation("io.sentry:sentry:8.3.0")
-    implementation("io.sentry:sentry-log4j2:8.3.0")
+
+    // API Documentation
     implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.5")
-    runtimeOnly("org.springframework.boot:spring-boot-devtools:3.4.3")
-    runtimeOnly("org.postgresql:postgresql:42.7.5")
+
+    // Devtools
+    runtimeOnly("org.springframework.boot:spring-boot-devtools")
+
+    // Testing
+    testImplementation("org.springframework.security:spring-security-test")
+    testImplementation("org.springframework.boot:spring-boot-starter-test")
+    testImplementation("org.springframework.restdocs:spring-restdocs-mockmvc:3.0.3")
     testImplementation("org.assertj:assertj-core:3.27.3")
-    testImplementation("org.springframework.security:spring-security-test:6.4.3")
-    testImplementation("org.testcontainers:testcontainers:1.20.5")
-    testImplementation("org.testcontainers:postgresql:1.20.5")
-    testImplementation("io.ktor:ktor-client-mock-jvm:3.1.1")
+    testImplementation("org.testcontainers:testcontainers:$testcontainersVersion")
+    testImplementation("org.testcontainers:postgresql:$testcontainersVersion")
+    testImplementation("org.testcontainers:junit-jupiter:$testcontainersVersion")
+    testImplementation("io.ktor:ktor-client-mock:$ktorVersion")
     testImplementation("jakarta.servlet:jakarta.servlet-api:6.1.0")
     testImplementation("com.squareup.okhttp3:mockwebserver:4.12.0")
-    testImplementation("org.springframework.boot:spring-boot-starter-test:3.4.3")
-    testImplementation("org.springframework.restdocs:spring-restdocs-mockmvc:3.0.3")
-    testImplementation("org.testcontainers:junit-jupiter:1.20.5")
-    testImplementation("net.java.dev.jna:jna:5.16.0")
     testImplementation("net.ttddyy:datasource-proxy:1.10.1")
     testImplementation("io.mockk:mockk:1.13.17")
+    testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")
 }
 
-group = "fr.gouv.cacem"
-version = "VERSION_TO_CHANGE"
-description = "MonitorEnv"
-java.sourceCompatibility = JavaVersion.VERSION_17
-
-/*
-// TODO Re-add this library When there will be no more IDE conflicts
-sourceSets {
-  create("publicApi") {
-    java {
-      srcDir("src/main/kotlin/fr/gouv/cacem/monitorenv/infrastructure/api/adapters/publicapi")
-    }
-  }
-}
-
-// This publication is only runned from the CI in Github Actions
-publishing {
path: backend/build.gradle.kts
user: login: claire2212
body: je suis pas sûre qu'il faille le supprimer c'était pour le package créé par Loup, pour récupérer les types back je crois. A voir avec lui s'il compte s'en reservir un jour
created_at: 2025-03-13T10:15:34Z
author_association: COLLABORATOR
diff_hunk: @@ -32,108 +47,84 @@ configurations.all {
     exclude(group = "org.springframework.boot", module = "spring-boot-starter-logging")
 }
 
-tasks.named("compileKotlin", org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask::class.java) {
+tasks.withType<KotlinCompile> {
     compilerOptions {
-        freeCompilerArgs.add("-Xjsr305=strict")
-        // jvmTarget.set(JvmTarget.JVM_17)
-        // javaParameters.set(true)
+        jvmTarget.set(JvmTarget.JVM_21)
+        freeCompilerArgs.set(listOf("-Xjsr305=strict"))
     }
 }
 
+val ktorVersion = "3.1.1"
+val testcontainersVersion = "1.20.5"
+val sentryVersion = "8.3.0"
+val flywayVersion = "11.3.4"
+
 dependencies {
-    implementation("org.springframework.boot:spring-boot-starter-web:3.4.3")
-    implementation("org.springframework.security:spring-security-oauth2-resource-server:6.4.3")
-    implementation("org.springframework.security:spring-security-oauth2-jose:6.4.3")
-    implementation("org.hibernate.validator:hibernate-validator:8.0.2.Final")
-    implementation("jakarta.validation:jakarta.validation-api:3.1.1")
-    implementation("org.springframework.boot:spring-boot-starter-actuator:3.4.3")
-    implementation("org.springframework.boot:spring-boot-starter-json:3.4.3")
-    implementation("org.springframework.boot:spring-boot-starter-security:3.4.3")
-    implementation("org.springframework.boot:spring-boot-starter-data-jpa:3.4.3")
+    implementation(platform("org.springframework.boot:spring-boot-dependencies:3.4.3"))
+
+    // Spring Boot
+    implementation("org.springframework.boot:spring-boot-starter-web")
+    implementation("org.springframework.boot:spring-boot-starter-security")
+    implementation("org.springframework.boot:spring-boot-starter-actuator")
+    implementation("org.springframework.boot:spring-boot-starter-cache")
+    implementation("org.springframework.boot:spring-boot-starter-data-jpa")
+    implementation("org.springframework.boot:spring-boot-starter-log4j2")
+    implementation("org.springframework.security:spring-security-oauth2-resource-server")
+    implementation("org.springframework.security:spring-security-oauth2-jose")
+    implementation("org.springframework.boot:spring-boot-configuration-processor")
+
+    // Database & Migration
+    implementation("org.postgresql:postgresql")
+    implementation("org.flywaydb:flyway-core:$flywayVersion")
+    implementation("org.flywaydb:flyway-database-postgresql:$flywayVersion")
     implementation("org.hibernate.orm:hibernate-spatial:6.6.9.Final")
-    implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.3")
-    implementation("org.n52.jackson:jackson-datatype-jts:1.2.10")
-    implementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")
-    implementation("org.flywaydb:flyway-core:11.3.4")
-    implementation("org.flywaydb:flyway-database-postgresql:11.3.4")
-    implementation("org.jetbrains.kotlin:kotlin-reflect:2.1.10")
-    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.1.10")
-    implementation("org.springframework.boot:spring-boot-configuration-processor:3.4.3")
+    implementation("org.hibernate.validator:hibernate-validator:8.0.2.Final")
+    implementation("io.hypersistence:hypersistence-utils-hibernate-63:3.9.2")
+
+    // Kotlin
+    implementation("org.jetbrains.kotlin:kotlin-reflect")
     implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1")
     implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0")
-    implementation("org.http4k:http4k-client-apache:5.46.0.0")
-    implementation("com.google.code.gson:gson:2.12.1")
-    implementation("org.springframework.boot:spring-boot-starter-cache:3.4.3")
+
+    // Jackson
+    implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.3")
+    implementation("org.n52.jackson:jackson-datatype-jts:1.2.10")
+
+    // HTTP Clients (Ktor)
+    implementation("io.ktor:ktor-client-core:$ktorVersion")
+    implementation("io.ktor:ktor-client-java:$ktorVersion")
+    implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
+    implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
+
+    // Monitoring & Logging
+    implementation("io.sentry:sentry:$sentryVersion")
+    implementation("io.sentry:sentry-log4j2:$sentryVersion")
+
+    // Cache
     implementation("com.github.ben-manes.caffeine:caffeine:3.2.0")
-    implementation("io.hypersistence:hypersistence-utils-hibernate-63:3.9.2")
-    implementation("org.springframework.boot:spring-boot-starter-log4j2:3.4.3")
-    implementation("io.ktor:ktor-client-core-jvm:3.1.1")
-    implementation("io.ktor:ktor-client-java-jvm:3.1.1")
-    implementation("io.ktor:ktor-client-content-negotiation-jvm:3.1.1")
-    implementation("io.ktor:ktor-serialization-kotlinx-json-jvm:3.1.1")
-    implementation("io.sentry:sentry:8.3.0")
-    implementation("io.sentry:sentry-log4j2:8.3.0")
+
+    // API Documentation
     implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.5")
-    runtimeOnly("org.springframework.boot:spring-boot-devtools:3.4.3")
-    runtimeOnly("org.postgresql:postgresql:42.7.5")
+
+    // Devtools
+    runtimeOnly("org.springframework.boot:spring-boot-devtools")
+
+    // Testing
+    testImplementation("org.springframework.security:spring-security-test")
+    testImplementation("org.springframework.boot:spring-boot-starter-test")
+    testImplementation("org.springframework.restdocs:spring-restdocs-mockmvc:3.0.3")
     testImplementation("org.assertj:assertj-core:3.27.3")
-    testImplementation("org.springframework.security:spring-security-test:6.4.3")
-    testImplementation("org.testcontainers:testcontainers:1.20.5")
-    testImplementation("org.testcontainers:postgresql:1.20.5")
-    testImplementation("io.ktor:ktor-client-mock-jvm:3.1.1")
+    testImplementation("org.testcontainers:testcontainers:$testcontainersVersion")
+    testImplementation("org.testcontainers:postgresql:$testcontainersVersion")
+    testImplementation("org.testcontainers:junit-jupiter:$testcontainersVersion")
+    testImplementation("io.ktor:ktor-client-mock:$ktorVersion")
     testImplementation("jakarta.servlet:jakarta.servlet-api:6.1.0")
     testImplementation("com.squareup.okhttp3:mockwebserver:4.12.0")
-    testImplementation("org.springframework.boot:spring-boot-starter-test:3.4.3")
-    testImplementation("org.springframework.restdocs:spring-restdocs-mockmvc:3.0.3")
-    testImplementation("org.testcontainers:junit-jupiter:1.20.5")
-    testImplementation("net.java.dev.jna:jna:5.16.0")
     testImplementation("net.ttddyy:datasource-proxy:1.10.1")
     testImplementation("io.mockk:mockk:1.13.17")
+    testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")
 }
 
-group = "fr.gouv.cacem"
-version = "VERSION_TO_CHANGE"
-description = "MonitorEnv"
-java.sourceCompatibility = JavaVersion.VERSION_17
-
-/*
-// TODO Re-add this library When there will be no more IDE conflicts
-sourceSets {
-  create("publicApi") {
-    java {
-      srcDir("src/main/kotlin/fr/gouv/cacem/monitorenv/infrastructure/api/adapters/publicapi")
-    }
-  }
-}
-
-// This publication is only runned from the CI in Github Actions
-publishing {
path: backend/build.gradle.kts
user: login: louptheron
body: Oui c'était pour publier les types Kotlin partagés (`Mission`, `ControlUnit`, etc) dans `https://maven.pkg.github.com/mtes-mct/monitorenv` pour RapportNav/MonitorFish, mais bon là j'aurais pas le temps de m'y remettre...
created_at: 2025-03-13T13:31:29Z
author_association: COLLABORATOR
diff_hunk: @@ -32,108 +47,84 @@ configurations.all {
     exclude(group = "org.springframework.boot", module = "spring-boot-starter-logging")
 }
 
-tasks.named("compileKotlin", org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask::class.java) {
+tasks.withType<KotlinCompile> {
     compilerOptions {
-        freeCompilerArgs.add("-Xjsr305=strict")
-        // jvmTarget.set(JvmTarget.JVM_17)
-        // javaParameters.set(true)
+        jvmTarget.set(JvmTarget.JVM_21)
+        freeCompilerArgs.set(listOf("-Xjsr305=strict"))
     }
 }
 
+val ktorVersion = "3.1.1"
+val testcontainersVersion = "1.20.5"
+val sentryVersion = "8.3.0"
+val flywayVersion = "11.3.4"
+
 dependencies {
-    implementation("org.springframework.boot:spring-boot-starter-web:3.4.3")
-    implementation("org.springframework.security:spring-security-oauth2-resource-server:6.4.3")
-    implementation("org.springframework.security:spring-security-oauth2-jose:6.4.3")
-    implementation("org.hibernate.validator:hibernate-validator:8.0.2.Final")
-    implementation("jakarta.validation:jakarta.validation-api:3.1.1")
-    implementation("org.springframework.boot:spring-boot-starter-actuator:3.4.3")
-    implementation("org.springframework.boot:spring-boot-starter-json:3.4.3")
-    implementation("org.springframework.boot:spring-boot-starter-security:3.4.3")
-    implementation("org.springframework.boot:spring-boot-starter-data-jpa:3.4.3")
+    implementation(platform("org.springframework.boot:spring-boot-dependencies:3.4.3"))
+
+    // Spring Boot
+    implementation("org.springframework.boot:spring-boot-starter-web")
+    implementation("org.springframework.boot:spring-boot-starter-security")
+    implementation("org.springframework.boot:spring-boot-starter-actuator")
+    implementation("org.springframework.boot:spring-boot-starter-cache")
+    implementation("org.springframework.boot:spring-boot-starter-data-jpa")
+    implementation("org.springframework.boot:spring-boot-starter-log4j2")
+    implementation("org.springframework.security:spring-security-oauth2-resource-server")
+    implementation("org.springframework.security:spring-security-oauth2-jose")
+    implementation("org.springframework.boot:spring-boot-configuration-processor")
+
+    // Database & Migration
+    implementation("org.postgresql:postgresql")
+    implementation("org.flywaydb:flyway-core:$flywayVersion")
+    implementation("org.flywaydb:flyway-database-postgresql:$flywayVersion")
     implementation("org.hibernate.orm:hibernate-spatial:6.6.9.Final")
-    implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.3")
-    implementation("org.n52.jackson:jackson-datatype-jts:1.2.10")
-    implementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")
-    implementation("org.flywaydb:flyway-core:11.3.4")
-    implementation("org.flywaydb:flyway-database-postgresql:11.3.4")
-    implementation("org.jetbrains.kotlin:kotlin-reflect:2.1.10")
-    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.1.10")
-    implementation("org.springframework.boot:spring-boot-configuration-processor:3.4.3")
+    implementation("org.hibernate.validator:hibernate-validator:8.0.2.Final")
+    implementation("io.hypersistence:hypersistence-utils-hibernate-63:3.9.2")
+
+    // Kotlin
+    implementation("org.jetbrains.kotlin:kotlin-reflect")
     implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1")
     implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0")
-    implementation("org.http4k:http4k-client-apache:5.46.0.0")
path: backend/build.gradle.kts
user: login: louptheron
body: Oui vous n'avez pas l'air d'utiliser Http4K
created_at: 2025-03-13T13:33:52Z
author_association: COLLABORATOR
diff_hunk: @@ -32,108 +47,84 @@ configurations.all {
     exclude(group = "org.springframework.boot", module = "spring-boot-starter-logging")
 }
 
-tasks.named("compileKotlin", org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask::class.java) {
+tasks.withType<KotlinCompile> {
     compilerOptions {
-        freeCompilerArgs.add("-Xjsr305=strict")
-        // jvmTarget.set(JvmTarget.JVM_17)
-        // javaParameters.set(true)
+        jvmTarget.set(JvmTarget.JVM_21)
+        freeCompilerArgs.set(listOf("-Xjsr305=strict"))
     }
 }
 
+val ktorVersion = "3.1.1"
+val testcontainersVersion = "1.20.5"
+val sentryVersion = "8.3.0"
+val flywayVersion = "11.3.4"
+
 dependencies {
-    implementation("org.springframework.boot:spring-boot-starter-web:3.4.3")
-    implementation("org.springframework.security:spring-security-oauth2-resource-server:6.4.3")
-    implementation("org.springframework.security:spring-security-oauth2-jose:6.4.3")
-    implementation("org.hibernate.validator:hibernate-validator:8.0.2.Final")
-    implementation("jakarta.validation:jakarta.validation-api:3.1.1")
-    implementation("org.springframework.boot:spring-boot-starter-actuator:3.4.3")
-    implementation("org.springframework.boot:spring-boot-starter-json:3.4.3")
-    implementation("org.springframework.boot:spring-boot-starter-security:3.4.3")
-    implementation("org.springframework.boot:spring-boot-starter-data-jpa:3.4.3")
+    implementation(platform("org.springframework.boot:spring-boot-dependencies:3.4.3"))
+
+    // Spring Boot
+    implementation("org.springframework.boot:spring-boot-starter-web")
+    implementation("org.springframework.boot:spring-boot-starter-security")
+    implementation("org.springframework.boot:spring-boot-starter-actuator")
+    implementation("org.springframework.boot:spring-boot-starter-cache")
+    implementation("org.springframework.boot:spring-boot-starter-data-jpa")
+    implementation("org.springframework.boot:spring-boot-starter-log4j2")
+    implementation("org.springframework.security:spring-security-oauth2-resource-server")
+    implementation("org.springframework.security:spring-security-oauth2-jose")
+    implementation("org.springframework.boot:spring-boot-configuration-processor")
+
+    // Database & Migration
+    implementation("org.postgresql:postgresql")
+    implementation("org.flywaydb:flyway-core:$flywayVersion")
+    implementation("org.flywaydb:flyway-database-postgresql:$flywayVersion")
     implementation("org.hibernate.orm:hibernate-spatial:6.6.9.Final")
-    implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.3")
-    implementation("org.n52.jackson:jackson-datatype-jts:1.2.10")
-    implementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")
-    implementation("org.flywaydb:flyway-core:11.3.4")
-    implementation("org.flywaydb:flyway-database-postgresql:11.3.4")
-    implementation("org.jetbrains.kotlin:kotlin-reflect:2.1.10")
-    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.1.10")
-    implementation("org.springframework.boot:spring-boot-configuration-processor:3.4.3")
+    implementation("org.hibernate.validator:hibernate-validator:8.0.2.Final")
+    implementation("io.hypersistence:hypersistence-utils-hibernate-63:3.9.2")
+
+    // Kotlin
+    implementation("org.jetbrains.kotlin:kotlin-reflect")
     implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1")
     implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0")
-    implementation("org.http4k:http4k-client-apache:5.46.0.0")
-    implementation("com.google.code.gson:gson:2.12.1")
-    implementation("org.springframework.boot:spring-boot-starter-cache:3.4.3")
+
+    // Jackson
+    implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.3")
+    implementation("org.n52.jackson:jackson-datatype-jts:1.2.10")
+
+    // HTTP Clients (Ktor)
+    implementation("io.ktor:ktor-client-core:$ktorVersion")
+    implementation("io.ktor:ktor-client-java:$ktorVersion")
+    implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
+    implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
+
+    // Monitoring & Logging
+    implementation("io.sentry:sentry:$sentryVersion")
+    implementation("io.sentry:sentry-log4j2:$sentryVersion")
+
+    // Cache
     implementation("com.github.ben-manes.caffeine:caffeine:3.2.0")
-    implementation("io.hypersistence:hypersistence-utils-hibernate-63:3.9.2")
-    implementation("org.springframework.boot:spring-boot-starter-log4j2:3.4.3")
-    implementation("io.ktor:ktor-client-core-jvm:3.1.1")
-    implementation("io.ktor:ktor-client-java-jvm:3.1.1")
-    implementation("io.ktor:ktor-client-content-negotiation-jvm:3.1.1")
-    implementation("io.ktor:ktor-serialization-kotlinx-json-jvm:3.1.1")
-    implementation("io.sentry:sentry:8.3.0")
-    implementation("io.sentry:sentry-log4j2:8.3.0")
+
+    // API Documentation
     implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.5")
-    runtimeOnly("org.springframework.boot:spring-boot-devtools:3.4.3")
-    runtimeOnly("org.postgresql:postgresql:42.7.5")
+
+    // Devtools
+    runtimeOnly("org.springframework.boot:spring-boot-devtools")
+
+    // Testing
+    testImplementation("org.springframework.security:spring-security-test")
+    testImplementation("org.springframework.boot:spring-boot-starter-test")
+    testImplementation("org.springframework.restdocs:spring-restdocs-mockmvc:3.0.3")
     testImplementation("org.assertj:assertj-core:3.27.3")
-    testImplementation("org.springframework.security:spring-security-test:6.4.3")
-    testImplementation("org.testcontainers:testcontainers:1.20.5")
-    testImplementation("org.testcontainers:postgresql:1.20.5")
-    testImplementation("io.ktor:ktor-client-mock-jvm:3.1.1")
+    testImplementation("org.testcontainers:testcontainers:$testcontainersVersion")
+    testImplementation("org.testcontainers:postgresql:$testcontainersVersion")
+    testImplementation("org.testcontainers:junit-jupiter:$testcontainersVersion")
+    testImplementation("io.ktor:ktor-client-mock:$ktorVersion")
     testImplementation("jakarta.servlet:jakarta.servlet-api:6.1.0")
     testImplementation("com.squareup.okhttp3:mockwebserver:4.12.0")
-    testImplementation("org.springframework.boot:spring-boot-starter-test:3.4.3")
-    testImplementation("org.springframework.restdocs:spring-restdocs-mockmvc:3.0.3")
-    testImplementation("org.testcontainers:junit-jupiter:1.20.5")
-    testImplementation("net.java.dev.jna:jna:5.16.0")
     testImplementation("net.ttddyy:datasource-proxy:1.10.1")
     testImplementation("io.mockk:mockk:1.13.17")
+    testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")
 }
 
-group = "fr.gouv.cacem"
-version = "VERSION_TO_CHANGE"
-description = "MonitorEnv"
-java.sourceCompatibility = JavaVersion.VERSION_17
-
-/*
-// TODO Re-add this library When there will be no more IDE conflicts
-sourceSets {
-  create("publicApi") {
-    java {
-      srcDir("src/main/kotlin/fr/gouv/cacem/monitorenv/infrastructure/api/adapters/publicapi")
-    }
-  }
-}
-
-// This publication is only runned from the CI in Github Actions
-publishing {
path: backend/build.gradle.kts
user: login: maximeperraultdev
body: On pourra le déterrer en temps voulu :@
created_at: 2025-03-13T14:07:08Z
author_association: COLLABORATOR

PR comments:
user: login: sonarqubecloud[bot]
created_at: 2025-03-13T10:07:42Z
body: ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=MTES-MCT_monitorenv&pullRequest=2164) **Quality Gate passed**  
Issues  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [1 New issue](https://sonarcloud.io/project/issues?id=MTES-MCT_monitorenv&pullRequest=2164&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=MTES-MCT_monitorenv&pullRequest=2164&issueStatuses=ACCEPTED)

Measures  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=MTES-MCT_monitorenv&pullRequest=2164&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=MTES-MCT_monitorenv&pullRequest=2164&metric=new_coverage&view=list)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=MTES-MCT_monitorenv&pullRequest=2164&metric=new_duplicated_lines_density&view=list)  
  
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=MTES-MCT_monitorenv&pullRequest=2164)


author_association: NONE