Kotlin 找不到Heroku任务阶段
我正试图将我的项目部署到Heroku上,我遵循了,但没有一个对我有效 我的gradle看起来像这样:Kotlin 找不到Heroku任务阶段,kotlin,heroku,ktor,Kotlin,Heroku,Ktor,我正试图将我的项目部署到Heroku上,我遵循了,但没有一个对我有效 我的gradle看起来像这样: apply plugin: 'kotlin' apply plugin: 'application' apply plugin: 'kotlinx-serialization' version '0.0.1' mainClassName = "io.ktor.server.jetty.EngineMain" task stage(dependsOn: ['clean', 'installDi
apply plugin: 'kotlin'
apply plugin: 'application'
apply plugin: 'kotlinx-serialization'
version '0.0.1'
mainClassName = "io.ktor.server.jetty.EngineMain"
task stage(dependsOn: ['clean', 'installDist'])
repositories {
mavenLocal()
jcenter()
maven { url 'https://kotlin.bintray.com/ktor' }
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
//Log
implementation "ch.qos.logback:logback-classic:$logback_version"
//KTor core
implementation "io.ktor:ktor-server-jetty:$ktor_version"
implementation "io.ktor:ktor-server-core:$ktor_version"
implementation "io.ktor:ktor-client-core:$ktor_version"
...
我已经用web:./build/install/my-ws/bin/my-ws创建了Procfile
我在终端上运行了/gradlew stage
,效果很好
但是当我按下heroku master键时,仍然会出现错误
remote: Building source:
remote:
remote: -----> Gradle app detected
remote: -----> Installing JDK 1.8... done
remote: -----> Building Gradle app...
remote: -----> executing ./gradlew stage
remote: Downloading https://services.gradle.org/distributions/gradle-4.10-all.zip
remote: ...............................................................................................................
remote:
remote: FAILURE: Build failed with an exception.
remote:
remote: * What went wrong:
remote: Task 'stage' not found in root project 'my-ws'.
remote:
确保阶段任务位于根项目中。如果不是,则声明一个依赖于子项目的任务:
task stage(dependsOn: [':subproject:stage'])
只需转到build.gradle文件并粘贴以下代码
tasks.create("stage") {
dependsOn("installDist")
}
同样的结果,如果您想在heroku上部署ktor应用程序,我已经尝试了您所说的和任务阶段(dependsOn:[':subproject:stage','installDist'])
。。请阅读关于ktor应用程序部署的中型博客