Is there a recommended way to build a ktor jar fil...
# ktor
b
Is there a recommended way to build a ktor jar file with a Flyway dependency? I would have preferred just using the ktor gradle plugin, but I couldn’t find a way to include the META_INF/services directory which Flyway requires. I ended up having to pull in ShadowJar and use
mergeServiceFiles()
.
m
We are using shadowJar as well at our company
a
Not sure what the problem is... 🙂 We're at least using Flyway without issues. Migration code:
Copy code
Flyway.configure().dataSource(datasource).load().apply {
            info().pending().apply {
                if (isNotEmpty()) {
                    <http://logger.info|logger.info>("Migrations being applied: $this")
                } else {
                    <http://logger.info|logger.info>("No migrations to apply")
                }
            }

            migrate()
        }
Flyway as normal dependency in Gradle. And then ShadowJar:
Copy code
named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
        manifest {
            attributes["Main-Class"] = mainClassString
        }
        archiveBaseName.set("myjar")
        mergeServiceFiles()
    }
I see now we have mergeServiceFiles() but have no clue if that is actually necessary. 🙂
b
Thank you both! Wanted that extra sanity check to make sure I wasn’t overlooking something.