Fix to run jar from command line

main
Kevin Belisle 2021-07-06 17:23:47 -04:00
parent ca3a8d6186
commit ca1cd8b8ac
2 changed files with 8 additions and 3 deletions

View File

@ -72,6 +72,12 @@ tasks.register<Copy>("copySinglePageApp") {
into(layout.buildDirectory.dir("resources/main/spa")) into(layout.buildDirectory.dir("resources/main/spa"))
} }
tasks.withType<Jar> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest { attributes["Main-Class"] = "xyz.etztech.stonks.AppKt" }
configurations["compileClasspath"].forEach { file: File -> from(zipTree(file.absoluteFile)) }
}
application { application {
// Define the main class for the application. // Define the main class for the application.
mainClass.set("xyz.etztech.stonks.AppKt") mainClass.set("xyz.etztech.stonks.AppKt")

View File

@ -24,9 +24,8 @@ fun initApiServer(apiServerPort: Int, database: Database) {
val app = val app =
Javalin.create { config -> Javalin.create { config ->
config.enableCorsForAllOrigins() config.enableCorsForAllOrigins()
config.addStaticFiles("./spa") config.addStaticFiles("spa")
config.addStaticFiles("/") config.addSinglePageRoot("/", "spa")
config.addSinglePageRoot("/", "./spa")
config.enforceSsl = false config.enforceSsl = false
config.ignoreTrailingSlashes = true config.ignoreTrailingSlashes = true
} }