Skip to content

Commit 5f09d7d

Browse files
committed
Switch to version catalogue
1 parent e91b3b7 commit 5f09d7d

4 files changed

Lines changed: 82 additions & 39 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
[![Kotlin](https://img.shields.io/badge/kotlin-2.2.0-blue.svg?logo=kotlin)](http://kotlinlang.org)
2-
[![Ktor](https://img.shields.io/badge/ktor-3.2.3-blue.svg)](https://github.com/ktorio/ktor)
1+
[![Kotlin](https://img.shields.io/badge/kotlin-2.2.20-blue.svg?logo=kotlin)](http://kotlinlang.org)
2+
[![Ktor](https://img.shields.io/badge/ktor-3.3.0-blue.svg)](https://github.com/ktorio/ktor)
33
[![Build](https://github.com/raharrison/kotlin-ktor-exposed-starter/workflows/Build/badge.svg)](https://github.com/raharrison/kotlin-ktor-exposed-starter/actions/workflows/build.yml)
44
[![codecov](https://codecov.io/gh/raharrison/kotlin-ktor-exposed-starter/branch/master/graph/badge.svg?token=v2k9oObm0C)](https://codecov.io/gh/raharrison/kotlin-ktor-exposed-starter)
55

66
## Starter project to create a simple RESTful web service in Kotlin
77

8-
**Updated for Kotlin 2.2.0 and Ktor 3.2.3**
8+
**Updated for Kotlin 2.2.20 and Ktor 3.3.0**
99

1010
Companion article: <https://ryanharrison.co.uk/2018/04/14/kotlin-ktor-exposed-starter.html>
1111

build.gradle.kts

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,37 @@
1-
val ktorVersion = "3.2.3"
2-
val exposedVersion = "0.61.0"
3-
val h2Version = "2.3.232"
4-
val hikariCpVersion = "6.2.1"
5-
val flywayVersion = "11.9.1"
6-
val logbackVersion = "1.5.17"
7-
val assertjVersion = "3.27.3"
8-
val restAssuredVersion = "5.5.6"
9-
val junitVersion = "5.13.4"
10-
111
plugins {
12-
kotlin("jvm") version "2.2.0"
13-
kotlin("plugin.serialization") version "2.2.0"
14-
id("org.jetbrains.kotlinx.kover") version "0.9.1"
15-
application
2+
alias(libs.plugins.kotlin.jvm)
3+
alias(libs.plugins.ktor)
4+
alias(libs.plugins.kotlin.plugin.serialization)
5+
alias(libs.plugins.kover)
166
}
177

188
repositories {
199
mavenCentral()
2010
}
2111

2212
dependencies {
23-
implementation("io.ktor:ktor-server-core:$ktorVersion")
24-
implementation("io.ktor:ktor-serialization:$ktorVersion")
25-
implementation("io.ktor:ktor-server-netty:$ktorVersion")
26-
implementation("io.ktor:ktor-server-call-logging:$ktorVersion")
27-
implementation("io.ktor:ktor-server-default-headers:$ktorVersion")
28-
implementation("io.ktor:ktor-server-websockets:$ktorVersion")
29-
implementation("io.ktor:ktor-server-content-negotiation:$ktorVersion")
30-
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
31-
32-
implementation("com.h2database:h2:$h2Version")
33-
implementation("org.jetbrains.exposed:exposed-core:$exposedVersion")
34-
implementation("org.jetbrains.exposed:exposed-jdbc:$exposedVersion")
35-
implementation("com.zaxxer:HikariCP:$hikariCpVersion")
36-
implementation("org.flywaydb:flyway-core:$flywayVersion")
37-
implementation("ch.qos.logback:logback-classic:$logbackVersion")
38-
39-
testImplementation(platform("org.junit:junit-bom:$junitVersion"))
40-
testImplementation("org.junit.jupiter:junit-jupiter")
41-
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
42-
testImplementation("org.assertj:assertj-core:$assertjVersion")
43-
testImplementation("io.rest-assured:rest-assured:$restAssuredVersion")
44-
testImplementation("io.ktor:ktor-client-cio:$ktorVersion")
13+
implementation(libs.bundles.ktor.server)
14+
implementation(libs.ktor.serialization.kotlinx.json)
15+
16+
implementation(libs.bundles.exposed)
17+
implementation(libs.h2)
18+
implementation(libs.hikaricp)
19+
implementation(libs.flyway)
20+
implementation(libs.logback)
21+
22+
testImplementation(platform(libs.junit.bom))
23+
testImplementation(libs.junit.jupiter)
24+
testRuntimeOnly(libs.junit.platform.launcher)
25+
testImplementation(libs.assertj)
26+
testImplementation(libs.restAssured)
27+
testImplementation(libs.ktor.client.cio)
4528
}
4629

4730
kotlin {
4831
jvmToolchain(21)
32+
compilerOptions {
33+
allWarningsAsErrors.set(true)
34+
}
4935
}
5036

5137
application {

gradle/libs.versions.toml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
[versions]
2+
kotlin = "2.2.20"
3+
ktor = "3.3.0"
4+
kover = "0.9.1"
5+
exposed = "0.61.0"
6+
h2 = "2.3.232"
7+
hikaricp = "6.2.1"
8+
flyway = "11.9.1"
9+
logback = "1.5.18"
10+
junit = "5.13.4"
11+
assertj = "3.27.3"
12+
restAssured = "5.5.6"
13+
14+
[libraries]
15+
ktor-server-core = { module = "io.ktor:ktor-server-core", version.ref = "ktor" }
16+
ktor-server-netty = { module = "io.ktor:ktor-server-netty", version.ref = "ktor" }
17+
ktor-server-call-logging = { module = "io.ktor:ktor-server-call-logging", version.ref = "ktor" }
18+
ktor-server-default-headers = { module = "io.ktor:ktor-server-default-headers", version.ref = "ktor" }
19+
ktor-server-websockets = { module = "io.ktor:ktor-server-websockets", version.ref = "ktor" }
20+
ktor-server-content-negotiation = { module = "io.ktor:ktor-server-content-negotiation", version.ref = "ktor" }
21+
ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
22+
23+
exposed-core = { module = "org.jetbrains.exposed:exposed-core", version.ref = "exposed" }
24+
exposed-jdbc = { module = "org.jetbrains.exposed:exposed-jdbc", version.ref = "exposed" }
25+
h2 = { module = "com.h2database:h2", version.ref = "h2" }
26+
hikaricp = { module = "com.zaxxer:HikariCP", version.ref = "hikaricp" }
27+
flyway = { module = "org.flywaydb:flyway-core", version.ref = "flyway" }
28+
logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
29+
30+
junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" }
31+
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter" }
32+
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher" }
33+
assertj = { module = "org.assertj:assertj-core", version.ref = "assertj" }
34+
restAssured = { module = "io.rest-assured:rest-assured", version.ref = "restAssured" }
35+
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
36+
37+
[bundles]
38+
ktor-server = [
39+
"ktor-server-core",
40+
"ktor-server-netty",
41+
"ktor-server-call-logging",
42+
"ktor-server-default-headers",
43+
"ktor-server-websockets",
44+
"ktor-server-content-negotiation"
45+
]
46+
47+
exposed = [
48+
"exposed-core",
49+
"exposed-jdbc",
50+
]
51+
52+
[plugins]
53+
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
54+
ktor = { id = "io.ktor.plugin", version.ref = "ktor" }
55+
kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
56+
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }

src/main/kotlin/util/JsonMapper.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ object JsonMapper {
66

77
val defaultMapper = Json {
88
prettyPrint = true
9+
ignoreUnknownKeys = true
910
}
1011

1112
}

0 commit comments

Comments
 (0)