在heroku上部署ktor项目时出错



开发人员您好,我是一名学生,正在Ktor项目中工作。我想在heroku上部署我的拼贴项目。但我坚持在Ktor项目部署帮助我如何解决它。我会提供我的错误日志

这是我的错误日志

2022-08-10T23:27:30.774776+00:00 heroku[web.1]: State changed from crashed to starting
2022-08-10T23:27:33.495899+00:00 heroku[web.1]: Starting process with command `build/install/example/bin/example`
2022-08-10T23:27:34.411007+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2022-08-10T23:27:34.411144+00:00 app[web.1]: bash: build/install/example/bin/example: No such file or directory
2022-08-10T23:27:34.564150+00:00 heroku[web.1]: Process exited with status 127
2022-08-10T23:27:34.839969+00:00 heroku[web.1]: State changed from starting to crashed
2022-08-10T23:27:55.000000+00:00 app[api]: Build succeeded
2022-08-10T23:28:16.724424+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=mighty-savannah-19369.herokuapp.com request_id=c5e35266-6ef5-4a42-9dac-6a894f06b4df fwd="109.249.187.28" dyno= connect= service= status=503 bytes= protocol=https
2022-08-10T23:28:16.999875+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=mighty-savannah-19369.herokuapp.com request_id=d29c073f-e8ce-45f3-b8cd-5b5a9099577f fwd="109.249.187.28" dyno= connect= service= status=503 bytes= protocol=https
2022-08-10T23:32:50.106331+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/robots.txt" host=mighty-savannah-19369.herokuapp.com request_id=a848f7f9-62d0-4063-a207-cb01fd01ec40 fwd="66.249.66.92" dyno= connect= service= status=503 bytes= protocol=http
2022-08-10T23:32:50.954114+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=mighty-savannah-19369.herokuapp.com request_id=4abc4eba-d021-491b-82b4-8525e0fe6905 fwd="46.40.5.5" dyno= connect= service= status=503 bytes= protocol=http
2022-08-10T23:32:51.587762+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=mighty-savannah-19369.herokuapp.com request_id=765cf552-f168-48b9-aa03-8b76d97eb635 fwd="170.84.132.5" dyno= connect= service= status=503 bytes= protocol=http

这是我的Build.gradle文件

val ktor_version: String by project
val kotlin_version: String by project
val logback_version: String by project
val exposed_version: String by project
val postgres_version: String by project
val hikari_version: String by project

plugins {
application
kotlin("jvm") version "1.7.0"
}
group = "com.example"
version = "0.0.1"
application {
mainClass.set("com.example.ApplicationKt")
val isDevelopment: Boolean = project.ext.has("development")
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=$isDevelopment")
}
tasks.create("stage"){
dependsOn("installDist")
}
repositories {
mavenCentral()
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/ktor/eap") }
}
dependencies {
implementation("io.ktor:ktor-server-content-negotiation-jvm:$ktor_version")
implementation("io.ktor:ktor-server-core-jvm:$ktor_version")
implementation("io.ktor:ktor-serialization-gson-jvm:$ktor_version")
implementation("io.ktor:ktor-server-locations-jvm:$ktor_version")
implementation("io.ktor:ktor-server-sessions-jvm:$ktor_version")
implementation("io.ktor:ktor-server-auth-jvm:$ktor_version")
implementation("io.ktor:ktor-server-auth-jwt-jvm:$ktor_version")
implementation("io.ktor:ktor-server-netty-jvm:$ktor_version")
implementation("ch.qos.logback:logback-classic:$logback_version")
testImplementation("io.ktor:ktor-server-tests-jvm:$ktor_version")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")
//DB Connection
implementation("org.jetbrains.exposed:exposed-core:$exposed_version")
implementation("org.jetbrains.exposed:exposed-dao:$exposed_version")
implementation("org.jetbrains.exposed:exposed-jdbc:$exposed_version")
implementation("org.postgresql:postgresql:$postgres_version")
implementation("com.zaxxer:HikariCP:$hikari_version")
}

请帮我解决这个问题。也给我建议我做错了什么。

这是一个迟来的答案,但我希望它能有所帮助。ktor文档的流量:https://ktor.io/docs/heroku.html#0并确保您的应用程序使用的最大JDK是JAVA_11。因为intellj支持的最后一个JAVA是JAVA_17,最大heroku支持是JAVA 11。

最新更新