From cb96739b0b4e8f63ff4ed348cce830eb0586eb86 Mon Sep 17 00:00:00 2001 From: anderssonw Date: Tue, 4 Jun 2024 10:57:08 +0200 Subject: [PATCH] setup version libs for gradle and dependabot --- build.gradle.kts | 52 ++++++++----------- gradle.properties | 5 -- gradle/libs.versions.toml | 40 ++++++++++++++ .../matrikkel/bygning/Application.kt | 1 - 4 files changed, 62 insertions(+), 36 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/build.gradle.kts b/build.gradle.kts index 10ba55e1..2562d6c4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,17 +1,11 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar -val ktor_version: String by project -val kotlin_version: String by project -val logback_version: String by project -val prometheus_version: String by project -val flyway_version: String by project - plugins { - kotlin("jvm") version "2.0.0" - kotlin("plugin.serialization") version "2.0.0" - id("io.ktor.plugin") version "2.3.11" + kotlin("jvm").version(libs.versions.kotlinVersion) + kotlin("plugin.serialization").version(libs.versions.kotlinVersion) - id("com.github.johnrengelman.shadow") version "8.1.1" + alias(libs.plugins.ktor) + alias(libs.plugins.shadow) } group = "no.kartverket.matrikkel.bygning" @@ -29,38 +23,36 @@ repositories { mavenCentral() } - - dependencies { // Ktor - implementation("io.ktor:ktor-server-core-jvm:$ktor_version") - implementation("io.ktor:ktor-server-netty-jvm:$ktor_version") - implementation("io.ktor:ktor-server-swagger:$ktor_version") - implementation("io.ktor:ktor-server-cors:$ktor_version") - implementation("io.ktor:ktor-server-openapi:$ktor_version") + implementation(libs.ktor.server.core) + implementation(libs.ktor.server.netty) + implementation(libs.ktor.server.swagger) + implementation(libs.ktor.server.cors) + implementation(libs.ktor.server.openapi) // Monitoring - implementation("io.ktor:ktor-server-call-logging:$ktor_version") - implementation("io.ktor:ktor-server-metrics-micrometer:$ktor_version") - implementation("io.micrometer:micrometer-registry-prometheus:$prometheus_version") + implementation(libs.ktor.server.call.logging) + implementation(libs.ktor.server.metrics.micrometer) + implementation(libs.micrometer.prometheus) // Logs - implementation("net.logstash.logback:logstash-logback-encoder:7.4") - implementation("ch.qos.logback:logback-classic:$logback_version") - implementation("com.fasterxml.jackson.core:jackson-databind:2.17.1") + implementation(libs.logstash.encoder) + implementation(libs.logback.classic) + implementation(libs.jackson.databind) // Serialization - implementation("io.ktor:ktor-server-content-negotiation-jvm:$ktor_version") - implementation("io.ktor:ktor-serialization-kotlinx-json-jvm:$ktor_version") + implementation(libs.ktor.server.content.negotiation) + implementation(libs.ktor.serialization.kotlinx) // Persistence - implementation("org.postgresql:postgresql:42.7.3") - implementation("org.flywaydb:flyway-core:$flyway_version") - implementation("org.flywaydb:flyway-database-postgresql:$flyway_version") + implementation(libs.postgres) + implementation(libs.flyway.core) + implementation(libs.flyway.database.postgresql) // Tests - testImplementation("io.ktor:ktor-server-tests-jvm:$ktor_version") - testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version") + testImplementation(libs.ktor.server.tests) + testImplementation(libs.kotlin.test) } ktor { diff --git a/gradle.properties b/gradle.properties index 3f4c5c81..7fc6f1ff 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1 @@ -ktor_version=2.3.11 -kotlin_version=2.0.0 -logback_version=1.4.14 -prometheus_version=1.10.3 -flyway_version=10.13.0 kotlin.code.style=official diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..62065015 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,40 @@ +[versions] +ktorVersion = "2.3.11" +kotlinVersion = "2.0.0" +logbackVersion = "1.4.14" +logstashVersion = "7.4" +prometheusVersion = "1.10.3" +flywayVersion = "10.13.0" +jacksonVersion = "2.17.1" +postgresVersion = "42.7.3" +shadowVersion = "8.1.1" + +[libraries] +ktor-server-core = { group = "io.ktor", name = "ktor-server-core-jvm", version.ref = "ktorVersion" } +ktor-server-netty = { group = "io.ktor", name = "ktor-server-netty-jvm", version.ref = "ktorVersion" } +ktor-server-swagger = { group = "io.ktor", name = "ktor-server-swagger", version.ref = "ktorVersion" } +ktor-server-cors = { group = "io.ktor", name = "ktor-server-cors", version.ref = "ktorVersion" } +ktor-server-openapi = { group = "io.ktor", name = "ktor-server-openapi", version.ref = "ktorVersion" } +ktor-server-tests = { group = "io.ktor", name = "ktor-server-tests-jvm", version.ref = "ktorVersion" } +ktor-server-call-logging = { group = "io.ktor", name = "ktor-server-call-logging", version.ref = "ktorVersion" } +ktor-server-metrics-micrometer = { group = "io.ktor", name = "ktor-server-metrics-micrometer", version.ref = "ktorVersion" } +ktor-server-content-negotiation = { group = "io.ktor", name = "ktor-server-content-negotiation-jvm", version.ref = "ktorVersion" } +ktor-serialization-kotlinx = { group = "io.ktor", name = "ktor-serialization-kotlinx-json-jvm", version.ref = "ktorVersion" } + +flyway-core = { group = "org.flywaydb", name = "flyway-core", version.ref = "flywayVersion" } +flyway-database-postgresql = { group = "org.flywaydb", name = "flyway-database-postgresql", version.ref = "flywayVersion" } + +micrometer-prometheus = { group = "io.micrometer", name = "micrometer-registry-prometheus", version.ref = "prometheusVersion" } +logstash-encoder = { group = "net.logstash.logback", name = "logstash-logback-encoder", version.ref = "logstashVersion" } +logback-classic = { group = "ch.qos.logback", name = "logback-classic", version.ref = "logbackVersion" } +jackson-databind = { group = "com.fasterxml.jackson.core", name = "jackson-databind", version.ref = "jacksonVersion" } +postgres = { group = "org.postgresql", name = "postgresql", version.ref = "postgresVersion" } +kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlinVersion" } + + +[plugins] +kotlin-jvm = { id = "jvm", version.ref = "kotlinVersion" } +kotlin-serialization = {id = "plugin.serialization", version.ref="kotlinVersion"} + +ktor = {id = "io.ktor.plugin", version.ref="ktorVersion" } +shadow = {id = "com.github.johnrengelman.shadow", version.ref="shadowVersion"} \ No newline at end of file diff --git a/src/main/kotlin/no/kartverket/matrikkel/bygning/Application.kt b/src/main/kotlin/no/kartverket/matrikkel/bygning/Application.kt index 53839b71..f71dc48e 100644 --- a/src/main/kotlin/no/kartverket/matrikkel/bygning/Application.kt +++ b/src/main/kotlin/no/kartverket/matrikkel/bygning/Application.kt @@ -26,7 +26,6 @@ fun Application.module() { install(ContentNegotiation) { json() removeIgnoredType() - removeIgnoredType() } install(CORS) {