Mark Fisher
01/09/2025, 7:16 PMio.ktor:ktor-server-config-yaml-jvm
dependency to a project, and build the jar
task, the default io.ktor.server.config.HoconConfigLoader
is not being added to the list of ConfigLoaders in META-INF/services/io.ktor.server.config.ConfigLoader
This has the knock on effect that the "application.conf" file in the root of the jar is not able to be loaded, as there is no ConfigLoader class available to handle that file type.
See thread. I've reproduced this in the examples application.Mark Fisher
01/09/2025, 8:42 PMMETA-INF/services/io.ktor.server.config.ConfigLoader
is missing this entry when you include the YAML config loader in the dependencies:
io.ktor.server.config.HoconConfigLoader
Mark Fisher
01/09/2025, 9:08 PMimplementation("io.ktor:ktor-server-config-yaml-jvm:$ktorVersion")
Then it swaps to only the Yaml config loader:
io.ktor.server.config.yaml.YamlConfigLoader
It seems that the default Hocon config is not listed if the Yaml one is included when building the jar file, but is when loading via IDE / jvmRun.
I think this should work, if you start the application via the "jvmRun" task (i.e. non JAR), then both ConfigLoader classes are loaded, but not through just running the jar file.Robert Jaros
01/10/2025, 5:02 PMshadowJar
task code. It was contributed very long time ago and it is still used:
https://github.com/rjaros/kvision/blob/master/kvision-tools/kvision-gradle-plugin/src/main/kotlin/io/kvision/gradle/KVisionPlugin.kt#L305-L314Robert Jaros
01/10/2025, 5:04 PMjvmRuntimeClasspath
configuration, but I have no idea what it really means 🙂Robert Jaros
01/10/2025, 5:06 PMMark Fisher
01/10/2025, 5:08 PM