视频讲解
部分脚本如下
import org.panteleyev.jpackage.ImageType
val kotlin_version: String by project
val logback_version: String by project
plugins {
kotlin("jvm") version "2.1.20"
id("io.ktor.plugin") version "3.1.2"
id("org.panteleyev.jpackageplugin") version "1.6.1"
}
group = "top.yunp"
version = "1.0.1"
application {
mainClass = "io.ktor.server.netty.EngineMain"
val isDevelopment: Boolean = project.ext.has("development")
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=$isDevelopment")
}
tasks.jpackage {
dependsOn(tasks.clean, tasks.installDist)
appName = project.name
type = ImageType.APP_IMAGE
destination = projectDir.resolve("build").resolve("jpackage").absolutePath
input = projectDir.resolve("build").resolve("install").resolve("jweb").resolve("lib").absolutePath
mainJar = "${project.name}-$version.jar"
mainClass = application.mainClass.get()
}
repositories {
mavenCentral()
}
dependencies {
implementation("io.ktor:ktor-server-core-jvm")
implementation("io.ktor:ktor-server-netty")
implementation("ch.qos.logback:logback-classic:$logback_version")
implementation("io.ktor:ktor-server-core")
implementation("io.ktor:ktor-server-config-yaml")
testImplementation("io.ktor:ktor-server-test-host")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")
}