artek
artek

Reputation: 161

Gradle Heroku Task 'stage'

I have a problem with deploying gradle project to heroku. Here is my gradle.build file

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
}

And I keep getting this error:

It looks like your project does not contain a 'stage' task, which Heroku needs in order to build your app

Upvotes: 2

Views: 1830

Answers (2)

Hamza Maqsood
Hamza Maqsood

Reputation: 415

here's how I have setup the stage task for my gradle project deployed on Heroku

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)

Upvotes: 0

artek
artek

Reputation: 161

I run this command heroku config:set GRADLE_TASK="build" in terminal and deploy became successful

Upvotes: 3

Related Questions