格拉德尔·希罗库任务"阶段"



我在将gradle项目部署到heroku时遇到问题。这是我的gradle.build文件

plugins {
id 'java'
id 'distribution'
}
group 'com.artek.ej_bot'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
flatDir {
dirs 'libs'
}
mavenCentral()
}
dependencies {
compile files(fileTree(dir: 'libs', includes: ['*.jar']))
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.6'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
task stage {
dependsOn installDist
}

我一直收到这个错误:

看起来你的项目不包含"阶段"任务,Heroku需要这个任务来构建你的应用

我在终端中运行此命令heroku config:set GRADLE_TASK="build",部署成功

以下是我如何为部署在Heroku 上的gradle项目设置阶段任务

task stage(type: Copy, dependsOn: ['build', 'clean', 'shadowJar']) {
from 'build/libs/app-0.0.1.jar'
into project.rootDir
rename {
'app.jar'
}
}
stage.mustRunAfter(clean)

最新更新