1
0

Use common versions

This commit is contained in:
Hubert Van De Walle 2020-10-06 18:40:38 +02:00
parent f0155dea31
commit a1dde23fb3
2 changed files with 45 additions and 36 deletions

View File

@ -16,6 +16,26 @@ display = "Java Version"
default = "1.4.10" default = "1.4.10"
display = "Kotlin Version" display = "Kotlin Version"
[versions]
http4k = "3.265.0"
pebble = "3.1.4"
caffeine = "2.8.5"
logback = "1.2.3"
mariadb = "2.6.2"
h2 = "1.4.200"
flyway = "7.0.0"
hikaricp = "3.4.5"
ktorm = "3.0.0"
junit = "5.7.0"
mokk = "1.10.0"
hamkrest = "1.7.0.3"
assertj = "3.17.2"
kodein-di = "7.1.0"
koin = "2.1.6"
jackson = "2.11.2"
kotlinx-serialization = "1.0-M1-1.4.0-rc"
arrow-core = "0.10.5"
[repositories] [repositories]
[repositories.jcenter] [repositories.jcenter]
@ -29,14 +49,13 @@ url = "https://dl.bintray.com/arrow-kt/arrow-kt/"
[dependencies.http4k] [dependencies.http4k]
groupId = "org.http4k" groupId = "org.http4k"
artifactId = "http4k-core" artifactId = "http4k-core"
version = "3.264.0"
category = "http4k" category = "http4k"
default = true default = true
[dependencies.http4k-server-jetty] [dependencies.http4k-server-jetty]
groupId = "org.http4k" groupId = "org.http4k"
artifactId = "http4k-server-jetty" artifactId = "http4k-server-jetty"
version = "3.264.0" version = "http4k"
category = "http4k" category = "http4k"
default = true default = true
logger = "org.eclipse.jetty" logger = "org.eclipse.jetty"
@ -44,94 +63,85 @@ logger = "org.eclipse.jetty"
[dependencies.http4k-server-apache] [dependencies.http4k-server-apache]
groupId = "org.http4k" groupId = "org.http4k"
artifactId = "http4k-server-apache" artifactId = "http4k-server-apache"
version = "3.264.0" version = "http4k"
category = "http4k" category = "http4k"
[dependencies.http4k-client-apache] [dependencies.http4k-client-apache]
groupId = "org.http4k" groupId = "org.http4k"
artifactId = "http4k-client-apache" artifactId = "http4k-client-apache"
version = "3.264.0" version = "http4k"
category = "http4k" category = "http4k"
[dependencies.http4k-format-jackson] [dependencies.http4k-format-jackson]
groupId = "org.http4k" groupId = "org.http4k"
artifactId = "http4k-format-jackson" artifactId = "http4k-format-jackson"
version = "3.264.0" version = "http4k"
category = "http4k" category = "http4k"
[dependencies.http4k-format-kotlinx-serialization] [dependencies.http4k-format-kotlinx-serialization]
groupId = "org.http4k" groupId = "org.http4k"
artifactId = "http4k-format-kotlinx-serialization" artifactId = "http4k-format-kotlinx-serialization"
version = "3.264.0" version = "http4k"
category = "http4k" category = "http4k"
[dependencies.http4k-contract] [dependencies.http4k-contract]
groupId = "org.http4k" groupId = "org.http4k"
artifactId = "http4k-contract" artifactId = "http4k-contract"
version = "3.264.0" version = "http4k"
category = "http4k" category = "http4k"
[dependencies.pebble] [dependencies.pebble]
groupId = "io.pebbletemplates" groupId = "io.pebbletemplates"
artifactId = "pebble" artifactId = "pebble"
version = "3.1.4"
default = true default = true
logger = "com.mitchellbosecke.pebble" logger = "com.mitchellbosecke.pebble"
[dependencies.caffeine] [dependencies.caffeine]
groupId = "com.github.ben-manes.caffeine" groupId = "com.github.ben-manes.caffeine"
artifactId = "caffeine" artifactId = "caffeine"
version = "2.8.5"
[dependencies.logback] [dependencies.logback]
groupId = "ch.qos.logback" groupId = "ch.qos.logback"
artifactId = "logback-classic" artifactId = "logback-classic"
version = "1.2.3"
default = true default = true
[dependencies.mariadb] [dependencies.mariadb]
groupId = "org.mariadb.jdbc" groupId = "org.mariadb.jdbc"
artifactId = "mariadb-java-client" artifactId = "mariadb-java-client"
version = "2.6.2"
category = "database" category = "database"
[dependencies.h2] [dependencies.h2]
groupId = "com.h2database" groupId = "com.h2database"
artifactId = "h2" artifactId = "h2"
version = "1.4.200"
category = "database" category = "database"
[dependencies.flyway] [dependencies.flyway]
groupId = "org.flywaydb" groupId = "org.flywaydb"
artifactId = "flyway-core" artifactId = "flyway-core"
version = "6.5.4"
category = "database" category = "database"
logger = "org.flywaydb.core" logger = "org.flywaydb.core"
[dependencies.HikariCP] [dependencies.hikaricp]
groupId = "com.zaxxer" groupId = "com.zaxxer"
artifactId = "HikariCP" artifactId = "HikariCP"
version = "3.4.5"
category = "database" category = "database"
logger = "com.zaxxer.hikari" logger = "com.zaxxer.hikari"
[dependencies.Ktorm] [dependencies.ktorm]
groupId = "me.liuwj.ktorm" groupId = "me.liuwj.ktorm"
artifactId = "ktorm-core" artifactId = "ktorm-core"
version = "3.0.0"
category = "database" category = "database"
logger = "me.liuwj.ktorm.database" logger = "me.liuwj.ktorm.database"
[dependencies.Ktorm-Mysql] [dependencies.ktorm-mysql]
groupId = "me.liuwj.ktorm" groupId = "me.liuwj.ktorm"
artifactId = "ktorm-support-mysql" artifactId = "ktorm-support-mysql"
version = "3.0.0" version = "ktorm"
category = "database" category = "database"
[dependencies.junit] [dependencies.junit]
groupId = "org.junit.jupiter" groupId = "org.junit.jupiter"
artifactId = "junit-jupiter" artifactId = "junit-jupiter"
version = "5.7.0"
scope = "test" scope = "test"
category = "test" category = "test"
default = true default = true
@ -139,7 +149,7 @@ default = true
[dependencies.junit-params] [dependencies.junit-params]
groupId = "org.junit.jupiter" groupId = "org.junit.jupiter"
artifactId = "junit-jupiter-params" artifactId = "junit-jupiter-params"
version = "5.7.0" version = "junit"
scope = "test" scope = "test"
category = "test" category = "test"
default = true default = true
@ -147,54 +157,46 @@ default = true
[dependencies.mokk] [dependencies.mokk]
groupId = "io.mockk" groupId = "io.mockk"
artifactId = "mockk" artifactId = "mockk"
version = "1.10.0"
scope = "test" scope = "test"
category = "test" category = "test"
[dependencies.hamkrest] [dependencies.hamkrest]
groupId = "com.natpryce" groupId = "com.natpryce"
artifactId = "hamkrest" artifactId = "hamkrest"
version = "1.7.0.3"
scope = "test" scope = "test"
category = "test" category = "test"
[dependencies.assertJ] [dependencies.assertj]
groupId = "org.assertj" groupId = "org.assertj"
artifactId = "assertj-core" artifactId = "assertj-core"
version = "3.17.2"
scope = "test" scope = "test"
category = "test" category = "test"
default = true default = true
[dependencies.Kodein-DI] [dependencies.kodein-di]
groupId = "org.kodein.di" groupId = "org.kodein.di"
artifactId = "kodein-di-jvm" artifactId = "kodein-di-jvm"
version = "7.0.0"
category = "injection" category = "injection"
repository = "jcenter" repository = "jcenter"
[dependencies.Koin] [dependencies.koin]
groupId = "org.koin" groupId = "org.koin"
artifactId = "koin-core" artifactId = "koin-core"
version = "2.1.6"
category = "injection" category = "injection"
repository = "jcenter" repository = "jcenter"
default = true default = true
[dependencies.Jackson] [dependencies.jackson]
groupId = "com.fasterxml.jackson.module" groupId = "com.fasterxml.jackson.module"
artifactId = "jackson-module-kotlin" artifactId = "jackson-module-kotlin"
version = "2.11.2"
category = "serialization" category = "serialization"
[dependencies.Kotlinx-serialization] [dependencies.kotlinx-serialization]
groupId = "org.jetbrains.kotlinx" groupId = "org.jetbrains.kotlinx"
artifactId = "kotlinx-serialization-runtime" artifactId = "kotlinx-serialization-runtime"
version = "1.0-M1-1.4.0-rc"
category = "serialization" category = "serialization"
[dependencies.Arrow-core] [dependencies.arrow-core]
groupId = "io.arrow-kt" groupId = "io.arrow-kt"
artifactId = "arrow-core" artifactId = "arrow-core"
version = "0.10.5"
repository = "arrow" repository = "arrow"

View File

@ -1,5 +1,6 @@
package starter.config package starter.config
import com.electronwill.nightconfig.core.UnmodifiableConfig
import com.electronwill.nightconfig.core.file.FileConfig import com.electronwill.nightconfig.core.file.FileConfig
import starter.* import starter.*
import com.electronwill.nightconfig.core.Config as NightConfig import com.electronwill.nightconfig.core.Config as NightConfig
@ -19,13 +20,19 @@ class Config {
val cfg = FileConfig.of("config.toml") val cfg = FileConfig.of("config.toml")
cfg.load() cfg.load()
@Suppress("UNCHECKED_CAST")
val versions = cfg.get<UnmodifiableConfig>("versions").valueMap() as Map<String, String>
val dependencies = cfg.configMap("dependencies") val dependencies = cfg.configMap("dependencies")
.map { (name, values) -> .map { (name, values) ->
val versionKey: String = values["version"] ?: name
val version = versions[versionKey] ?: error("Missing version for $name")
Dependency( Dependency(
name, name,
values["groupId"], values["groupId"],
values["artifactId"], values["artifactId"],
values["version"], version,
values.getOrElse("default", false), values.getOrElse("default", false),
values.getEnumOrElse("category", Category.Other), values.getEnumOrElse("category", Category.Other),
values.getEnumOrElse("scope", Scope.Compile), values.getEnumOrElse("scope", Scope.Compile),